Creating dialogue box.

@return string
776080
public function run()
    {
        $languageSource = LanguageSource::find()->where([
            'category' => Yii::$app->request->post('category', ''),
            'MD5(message)' => Yii::$app->request->post('hash', ''),
        ])->one();

        if (!$languageSource) {
            return '<div id="translate-manager-error">' . Yii::t('language', 'Text not found in database! Please run project scan before translating!') . '</div>';
        }

        return $this->controller->renderPartial('dialog', [
            'languageSource' => $languageSource,
            'languageTranslate' => $this->_getTranslation($languageSource),
        ]);
    }
1256358
private function createLeftMenu(): string
    {
        $argsCount = 0;
        $arrayKey = $this->getArrayKey($this->menuData);
        $output = '<ul class="navbar navbar-nav mr-auto">';
        foreach ($arrayKey as $menuItem) {
            list($url, $text, $place, $id, $class) = $this->getLinkInformation([$menuItem]);
            if ($place == 'left') {
                $arguments[$argsCount] = $menuItem;
                $arraySubKey = $this->getArrayKey($this->menuData[$menuItem]);
                if (count($arraySubKey) === 0) {
                    $output .= '<li class="nav-item">';
                    $output .= $this->createNavLinkUrl($arguments);
                    $output .= '</li>';
                } else {
                    $output .= '<li class="nav-item dropdown">';
                    $output .= $this->createSubmenu($arguments, $this->menuData[$menuItem]);
                    $output .= '</li>';
                }
            }
        }
        $output .= '</ul>';
        return $output;
    }
1018289
public function generate()
	{
		$arrOptions = array();
		$strClass = 'tl_select';
		$strStyle = '<style>.group-result {padding-top: 5px !important; line-height: 20px !important;}';
		$count = 1;

		if ($this->multiple)
		{
			$this->strName .= '[]';
			$strClass = 'tl_mselect';
		}

		// Add an empty option (XHTML) if there are none
		if (empty($this->arrOptions))
		{
			$this->arrOptions = array(array('value'=>'', 'label'=>'-'));
		}
		
		foreach ($this->arrOptions as $strKey=>$arrOption)
		{
			if (isset($arrOption['value']))
			{
				$arrOptions[] = sprintf('<option value="%s"%s>%s</option>',
										 \StringUtil::specialchars($arrOption['value']),
										 $this->isSelected($arrOption),
										 $arrOption['label']);

				if (isset($GLOBALS['TL_CTB_IMG'][$arrOptgroup['value']]))
				{
					$objImage = \FilesModel::findByUuid($GLOBALS['TL_CTB_IMG'][$arrOptgroup['value']]);
				}
				
				if ($objImage === null)
				{
					$strStyle .= '#ctrl_type_chzn_o_'.$count.' {position: relative; padding-left: 90px; line-height: 41px;}#ctrl_type_chzn_o_'.$count++.'::before {content: ""; position: absolute; left: 20px; top:2px; width: 60px; height: 40px; border: 1px solid #ccc; background: #eee; background-size: 60px 40px;}';
				}
				else
				{
					$strStyle .= '#ctrl_type_chzn_o_'.$count.' {position: relative; padding-left: 90px; line-height: 41px;}#ctrl_type_chzn_o_'.$count++.'::before {content: ""; position: absolute; left: 20px; top:2px; width: 60px; height: 40px; border: 1px solid #ccc; background: #eee url('.$objImage->path.'); background-size: 60px 40px;}';
				}
			}
			else
			{
				$arrOptgroups = array();

				foreach ($arrOption as $arrOptgroup)
				{
					$arrOptgroups[] = sprintf('<option value="%s"%s>%s</option>',
											   \StringUtil::specialchars($arrOptgroup['value']),
											   $this->isSelected($arrOptgroup),
											   $arrOptgroup['label']);

					if (isset($GLOBALS['TL_CTB_IMG'][$arrOptgroup['value']]))
					{
						$objImage = \FilesModel::findByUuid($GLOBALS['TL_CTB_IMG'][$arrOptgroup['value']]);
					}

					if ($objImage === null)
					{
						$strStyle .= '#ctrl_type_chzn_o_'.$count.' {position: relative; padding-left: 90px; line-height: 41px;}#ctrl_type_chzn_o_'.$count++.'::before {content: ""; position: absolute; left: 20px; top:2px; width: 60px; height: 40px; border: 1px solid #ccc; background: #eee; background-size: 60px 40px;}';
					}
					else
					{
						$strStyle .= '#ctrl_type_chzn_o_'.$count.' {position: relative; padding-left: 90px; line-height: 41px;}#ctrl_type_chzn_o_'.$count++.'::before {content: ""; position: absolute; left: 20px; top:2px; width: 60px; height: 40px; border: 1px solid #ccc; background: #eee url('.$objImage->path.'); background-size: 60px 40px;}';
					}

				}

				$arrOptions[] = sprintf('<optgroup label="&nbsp;%s">%s</optgroup>', \StringUtil::specialchars($strKey), implode('', $arrOptgroups));
				$count++;
			}
		}

		// Chosen
		if ($this->chosen)
		{
			$strClass .= ' tl_chosen';
		}


		$strStyle .= '</style>';
	
		return sprintf('%s<select name="%s" id="ctrl_%s" class="%s%s"%s onfocus="Backend.getScrollOffset()">%s</select>%s',
						($this->multiple ? '<input type="hidden" name="'. rtrim($this->strName, '[]') .'" value="">' : ''),
						$this->strName,
						$this->strId,
						$strClass,
						(($this->strClass != '') ? ' ' . $this->strClass : ''),
						$this->getAttributes(),
						implode('', $arrOptions),
						$strStyle);
	}
680015
private function createCommandDocument()
    {
        $pipeline = [
            ['$match' => (object) $this->filter]
        ];

        if (isset($this->options['skip'])) {
            $pipeline[] = ['$skip' => $this->options['skip']];
        }

        if (isset($this->options['limit'])) {
            $pipeline[] = ['$limit' => $this->options['limit']];
        }

        $pipeline[] = ['$group' => ['_id' => null, 'n' => ['$sum' => 1]]];

        $cmd = [
            'aggregate' => $this->collectionName,
            'pipeline' => $pipeline,
            'cursor' => (object) [],
        ];

        if (isset($this->options['collation'])) {
            $cmd['collation'] = (object) $this->options['collation'];
        }

        if (isset($this->options['hint'])) {
            $cmd['hint'] = is_array($this->options['hint']) ? (object) $this->options['hint'] : $this->options['hint'];
        }

        if (isset($this->options['maxTimeMS'])) {
            $cmd['maxTimeMS'] = $this->options['maxTimeMS'];
        }

        return $cmd;
    }
55483
public function buildScriptText()
    {
        $scriptText = PHP_EOL;
        $scriptText .= $this->getHeaderComment();
        $scriptText .= $this->getIncludes();
        $scriptText .= $this->getConstants();
        $scriptText .= $this->getFunctions();
        $scriptText .= $this->getLabels();
        $scriptText .= $this->getMainFunction();
        return $scriptText;
    }
584946
protected function buildStatement(): string
    {
        $this->statementBuilder->addFlags($this->flags);
        $this->statementBuilder->addCols($this->cols);
        $this->statementBuilder->addFrom($this->from);
        $this->statementBuilder->addJoin($this->join);
        $this->statementBuilder->addWhere($this->where);
        $this->statementBuilder->addGroupBy($this->groupBy);
        $this->statementBuilder->addHaving($this->having);
        $this->statementBuilder->addOrderBy($this->orderBy);
        $this->statementBuilder->addLimitOffset($this->limit, $this->offset);

        return $this->statementBuilder->getStatement();
    }
990900
def create_dialog(self):
        """"""
        self.bbox = QDialogButtonBox(QDialogButtonBox.Ok | 
                QDialogButtonBox.Cancel)
        self.idx_ok = self.bbox.button(QDialogButtonBox.Ok)
        self.idx_cancel = self.bbox.button(QDialogButtonBox.Cancel)

        filebutton = QPushButton()
        filebutton.setText('Choose')
        self.idx_filename = filebutton

        self.new_format = FormMenu(['EDF', 'Wonambi'])
        self.all_time = FormBool('Entire length of record')
        self.all_chan = FormBool('All channels')

        self.times = {}
        self.times['beg'] = FormFloat()
        self.times['end'] = FormFloat()

        chan_box = QListWidget()
        chan_box.setSelectionMode(QAbstractItemView.ExtendedSelection)
        self.idx_chan = chan_box

        filebutton.clicked.connect(self.save_as)
        self.all_time.connect(self.toggle_buttons)
        self.all_chan.connect(self.toggle_buttons)
        self.bbox.clicked.connect(self.button_clicked)

        self.all_time.set_value(True)
        self.all_chan.set_value(True)

        form = QFormLayout()
        form.addRow('Filename',
                    filebutton)
        #form.addRow('Format', self.new_format)
        form.addRow(self.all_time)
        form.addRow('Start time (sec)',
                    self.times['beg'])
        form.addRow('End time (sec)',
                    self.times['end'])
        form.addRow(self.all_chan)
        form.addRow('Channel(s)',
                    self.idx_chan)

        btnlayout = QHBoxLayout()
        btnlayout.addStretch(1)
        btnlayout.addWidget(self.bbox)

        vlayout = QVBoxLayout()
        vlayout.addLayout(form)
        vlayout.addStretch(1)
        vlayout.addLayout(btnlayout)

        self.setLayout(vlayout)
551244
public function input() {

		$input  = '';
		$values = (array) $this->get_value();
		$id     = $this->id();

		foreach ( $this->struct['choices'] as $option_value => $option_label ) {
			$sel       = null;
			$option_id = $id . '-' . sanitize_key( $option_value );
			if ( in_array( $option_value, $values ) ) {
				$sel = ' checked="checked"';
			}

			$input .= '<div class="uix-' . esc_attr( $this->type ) . '">';
			$input .= '<label for="' . $option_id . '">';
			$input .= '<input id="' . $option_id . '" ' . $this->build_attributes() . ' value="' . esc_attr( $option_value ) . '"' . $sel . '>';
			$input .= esc_html( $option_label );
			$input .= '</label>';
			$input .= '</div>';
		}

		return $input;
	}
1059189
public function buildMessage()
    {
        if (!empty($this->message)) {
            return $this->message;
        }

        foreach ($this->texts as $text) {
            $this->message[] = [
                'type' => MessageType::TEXT,
                'text' => $text,
            ];
        }

        if ($this->quickReply) {
            $lastKey = count($this->message) - 1;

            // If the user receives multiple message objects.
            // The quickReply property of the last message object is displayed.
            $this->message[$lastKey]['quickReply'] = $this->quickReply->buildQuickReply();
        }

        return $this->message;
    }
128400
public static function prompt()
    {
        $stdin = fopen('php://stdin', 'r');
        $answer = self::trimAnswer(fgets($stdin, 4096));
        fclose($stdin);

        return $answer;
    }
1321893
protected function buildTextPart()
    {
        if ($this->body === false) {
            $result = null;
        } else {
            $result = new MimePart($this->body);
            $result->setType(Mime::TYPE_TEXT);
            $result->setCharset(APP_CHARSET);
        }

        return $result;
    }
1336453
function createComment() {
    $cnt = count( $this->comment );
     if( 0 >= $cnt )
      return;
    $comment = null;
    foreach( $this->comment as $commentPart ) {
      $attributes = $this->_createParams( $commentPart['params'], array( 'ALTREP', 'LANGUAGE' ));
      $content    = $this->_strrep( $commentPart['value'] );
      $comment   .= $this->_createElement( 'COMMENT', $attributes, $content );
    }
    return $comment;
  }
586686
protected function _createMessage()
    {
        $message = Swift_Message::newInstance()
        ->setCharset($this->_charset)
        ->setContentType($this->_contentType)
        ->setPriority($this->_priority)
        ->setMaxLineLength($this->_maxLineLength)
        ->setSubject($this->_subject)
        ->setTo($this->_to)
        ->setBody($this->_body);

        if(!empty($this->_cc)) {
            $message->setCc($this->_cc);
        }

        if(!empty($this->_bcc)) {
            $message->setBcc($this->_bcc);
        }

        if(!empty($this->_sender)) {
            $message->setSender($this->_sender);
        } else {
            $message->setSender($this->_site_settings->mailfrom, $this->_site_settings->fromname);
        }

        if(!empty($this->_from)) {
            $message->setFrom($this->_from);
        } else {
            $message->setFrom($this->_site_settings->mailfrom, $this->_site_settings->fromname);
        }

        if(count($this->_reply_to)) {
            $message->setReplyTo($this->_reply_to);
        } else {
            $message->setReplyTo($this->_site_settings->mailfrom, $this->_site_settings->fromname);
        }

        return $message;
    }
294486
public function createPreviewTextElement() {
        $options['label']    = $this->translate->_('Preview Text');
        $options['nohidden'] = true;

        return $this->_form->createElement('Html', 'preview_text', $options);
    }
1325437
public function getOptionParser()
    {
        $parser = parent::getOptionParser();

        $parser->addSubcommand('initialize', [
            'help' => 'Execute The Initialize-method. This will add some important data to your database.',
            'parser' => $this->Initialize->getOptionParser(),
        ]);
        $parser->addSubcommand('user', [
            'help' => 'Execute The User-task. You will be able to create an user.',
            'parser' => $this->User->getOptionParser(),
        ]);

        return $parser;
    }
705289
public function getMessage()
    {
        return sprintf('The field `%s` length should be between %d and %d. (%d given) !',
            $this->inputName, $this->getArg(0), $this->getArg(1), $this->getValue());
    }
1000120
private function build() {

    	if(null === $this -> text) {

    		$html = '<input type="'. $this -> type .'"';
    		
    		foreach($this -> attributes as $attribute => $value) {
    		    $html .= ' ' . $attribute . '="'. Escape :: attr($value) .'"';
    		}

    		$html .= '>';

    		return $html;
    	}

        $this -> fill();
        
        $html = '<button';
        
        foreach($this -> attributes as $attribute => $value) {
            $html .= ' ' . $attribute . '="'. Escape :: attr($value) .'"';
        }

        $html .= '>' . Escape :: html($this -> text) . '</button>';

        return $html;
        
    }