Build compact for create form
@return mixed|string
774337
public function compactBuilder()
    {
        if ($this->relationships == 0 && $this->enum == 0) {
            return '';
        } else {
            $compact = ', compact($RELATIONS$)';
            if ($this->relationships > 0) {
                $first = true;
                foreach ($this->fields as $field) {
                    if ($field->type == 'relationship') {
                        $toReplace = '';
                        if ($first != true) {
                            $toReplace .= ', ';
                        } else {
                            $first = false;
                        }
                        $toReplace .= '"' . $field->relationship_name . '"$RELATIONS$';
                        $compact = str_replace('$RELATIONS$', $toReplace, $compact);
                    }
                }
            }
            if ($this->enum > 0) {
                if (! isset($first)) {
                    $first = true;
                }
                foreach ($this->fields as $field) {
                    if ($field->type == 'enum') {
                        $toReplace = '';
                        if ($first != true) {
                            $toReplace .= ', ';
                        } else {
                            $first = false;
                        }
                        $toReplace .= '"' . $field->title . '"$RELATIONS$';
                        $compact = str_replace('$RELATIONS$', $toReplace, $compact);
                    }
                }
            }
            $compact = str_replace('$RELATIONS$', '', $compact);

            return $compact;
        }
    }
579862
protected function build()
    {
        $content = '';
        if (isset($this->parameters) && is_array($this->parameters)) {
            $content = http_build_query($this->parameters);
        }
        if (isset($this->body)) {
            $content = $this->body;
        }

        $content_type = 'application/x-www-form-urlencoded; charset=utf-8';
        if (substr($content, 0, 6) == '<?xml ') {
            $content_type = 'text/xml; charset=utf-8';
        }

        $this->request = array(
            'http' => array(
                'header' => 'Content-type: ' . $content_type,
                'method' => 'POST',
                'timeout' => 5,
                'max_redirects' => 0,
                'ignore_errors' => 1,
                'content' => $content,
            )
        );

        return $this;
    }
1347805
public function build()
    {
        $sql = [
            $this->table->build(),
            $this->set->build(),
            $this->where->build(),
            $this->orderBy->build(),
            $this->limit->build(),
        ];

        $this->values = array_merge(
            array_values($this->set->getValues()),
            $this->where->getValues());

        return implode(' ', array_filter($sql));
    }
654170
protected function buildForm()
    {
        $this->form = Yii::createObject(array_merge([
            'scenario' => $this->scenario,
            'parent_id' => $this->parent_id,
            'parentTariff' => $this->parentTariff,
            'tariff' => $this->tariff,
        ], $this->getFormOptions()));
    }
264393
private function buildQuery()
    {
        $select = $this->buildSelect();

        $from = $this->buildFrom();

        $within = $this->buildWithin();

        $wheres = $this->buildWheres();

        $query = sprintf('%s %s %s %s', $select, $from, $within, $wheres);

        return trim($query);
    }
27733
protected function buildEmbeddedForm()
    {
        $form = new EmbeddedForm($this->column);

        $form->setParent($this->form);

        call_user_func($this->builder, $form);

        $form->fill($this->getEmbeddedData());

        return $form;
    }
1239009
public function create()
    {
        $File = new File($this->path());

        if (!$File->readable()) {
            $minifier = $this->type === 'css' ? new Minify\CSS() : new Minify\JS();
            array_map([$minifier, 'add'], $this->paths);

            //Writes the file
            $success = $File->write($minifier->minify());
            is_true_or_fail($success, __d('assets', 'Failed to create file {0}', rtr($this->path())));
        }

        return $this->filename();
    }
93701
public function getForm() {
		$form = new Form();
		
		$useBlacklist = (count($this->propertyBlacklist) > 0) ? true : false;
		$useWhitelist = (count($this->propertyWhitelist) > 0) ? true : false;
		
		$properties = EntityReader::getProperties($this->entityNamespace);
		foreach ($properties as $property) {
			$name = $property->getName();
			if (($useWhitelist && !in_array($name, $this->propertyWhitelist)) || ($useBlacklist && in_array($name, $this->propertyBlacklist))) {
				continue;
			}
			
			switch ($property->getType()) {
				case Property::PROPERTY_TYPE_COLUMN:
					if (!($property->getAnnotation() instanceof \Doctrine\ORM\Mapping\Id)) {
						$this->addColumnElementToForm($form, $property);
					}
					break;
				case Property::PROPERTY_TYPE_REF_ONE:
					$this->addSingleSelecterElementToForm($form, $property);
					break;
				case Property::PROPERTY_TYPE_REF_MANY:
					$this->addMultiSelecterElementToForm($form, $property);
					break;
				default:
					continue 2;
			}
		}
		
		$submit = new Submit('save');
		$submit->setValue('save');
		$form->add($submit);
		
		return $form;
	}
1273170
def directories_to_compact
      builds = Dir.entries builds_dir
      builds.select! {|e| File.directory? builds_dir(e) }
      builds.reject! {|e| %w{. ..}.include? e }
      builds.sort!
      
      builds = builds[0..-(@num_builds_to_leave+1)]
      builds.reject! {|e| @builds_to_leave.include?(e) || @builds_to_leave.include?(builds_dir(e, 'export'))}

      builds
    end
1003148
public function getForm()
	{
		$form = new App_Form_New();

		$elements = [];

		foreach($this->_settings as $column => $setting)
		{
			if(!$this->recordColumnExists($column) )
			{
				continue;
			}

			if(isset($setting['show_in']) && (isset($setting['show_in']) && !in_array('form', $setting['show_in'])))
			{
				continue;
			}

			$settingColumn = array(
				'type' => 'text'
			);

			if(isset($setting['formOptions']))
			{
				$settingColumn['options'] = $setting['formOptions'];
			}
			elseif(!array_key_exists('options', $settingColumn))
			{
				$settingColumn['options'] = array();
			}

			$type = 'text';
			if(isset($setting['type']))
			{
				$type = $setting['type'];
			}
			if(isset($setting['label']))
			{
				$settingColumn['options']['label'] = $setting['label'];
			}
			elseif(isset($setting['title']))
			{
				$settingColumn['options']['label'] = $setting['title'];
			}

			if(isset($setting['options']['validators']))
			{
				$settingColumn['options']['validators'] = $setting['validators'];
			}
			if(isset($setting['filters']))
			{
				$settingColumn['options']['filters'] = $setting['filters'];
			}
			if(isset($setting['decorators']))
			{
				$settingColumn['options']['decorators'] = $setting['decorators'];
			}

			if(isset($setting['helper']) && isset($setting['helper']['name']))
			{
				/* TODO 20150401 : make helper definition compatible with FormElement one
				$settingColumn['options']['helper'] = $setting['helper']['name'];
				*/
			}

			switch($type)
			{
				case "boolean":
				case "bool":
					if(!isset($settingColumn['options']['decorators']))
					{
						$settingColumn['options']['decorators'] = $form->elementDecorators;
					}
					break;
				case "array":
					if(!isset($settingColumn['options']['decorators']))
					{
						$settingColumn['options']['decorators'] = $form->elementDecorators;
					}
					break;
				case "date":
					if(!isset($settingColumn['options']['validators']['date']))
					{
						$settingColumn['options']['validators']['date'] = array('Date',false,array('Y-m-d'));
					}
					if(!isset($settingColumn['options']['decorators']))
					{
						$settingColumn['options']['decorators'] = $form->elementDecorators;
					}
					break;
				case "datetime":
					if(!isset($settingColumn['options']['validators']['date']))
					{
						$settingColumn['options']['validators']['date'] = array('Date',false,array('Y-m-d H:i:s'));
					}
					if(!isset($settingColumn['options']['decorators']))
					{
						$settingColumn['options']['decorators'] = $form->elementDecorators;
					}
					break;
				case "time":
					if(!isset($settingColumn['options']['validators']['date']))
					{
						$settingColumn['options']['validators']['date'] = array('Date',false,array('H:i:s'));
					}
					if(!isset($settingColumn['options']['decorators']))
					{
						$settingColumn['options']['decorators'] = $form->elementDecorators;
					}
					break;
				case "uint":
				case "int":
					@$settingColumn['options']['validators'][] = 'Int';
					if(!isset($settingColumn['options']['decorators']))
					{
						$settingColumn['options']['decorators'] = $form->elementDecorators;
					}
					break;
				case "float":
					if(!isset($settingColumn['options']['decorators']))
					{
						$settingColumn['options']['decorators'] = $form->elementDecorators;
					}
					break;
				case "email":
					@$settingColumn['options']['validators'][] = 'EmailAddress';
					if(!isset($settingColumn['options']['decorators']))
					{
						$settingColumn['options']['decorators'] = $form->elementDecorators;
					}
					break;
				case "host":
					@$settingColumn['options']['validators'][] = 'Hostname';
					if(!isset($settingColumn['options']['decorators']))
					{
						$settingColumn['options']['decorators'] = $form->elementDecorators;
					}
					break;
				case "text":
					if(!isset($settingColumn['options']['decorators']))
					{
						$settingColumn['options']['decorators'] = $form->elementDecorators;
					}
					break;
				case "hidden":
					if(!isset($settingColumn['options']['decorators']))
					{
						$settingColumn['options']['decorators'] = $form->hiddenDecorators;
					}
					break;
				default:
					debug_assert(false !== array_search($type, self::$types), "Unknown Form Type `{$type}`");
					break;
			}

			if(isset($setting['formType']))
			{
				$settingColumn['type'] = $setting['formType'];
			}
			else
			{
				$settingColumn['type'] = $this->_getFormType($type);
			}
			if(isset($setting['unique']) && $setting['unique'] == true)
			{
				if(!isset($settingColumn['options']['validators']))
				{
					$settingColumn['options']['validators'] = array();
				}
				if(!isset($settingColumn['options']['validators']['unique']))
				{
					$settingColumn['options']['validators']['unique'] = array('Db_RecordNotExistOrIsUnique', false, array(array(
						'table' => $this->getTable(),
						'field' => $column,
						'primary_key' => $this->getPrimaryKey()
					)));
				}
			}
			if(isset($setting['required']) && $setting['required'] == true)
			{
				$settingColumn['options']['required'] = true;
			}

			if(isset($setting['multiOptions']))
			{
				$multiOptions = $setting['multiOptions'];
				if($settingColumn['type'] == 'select' || (isset($settingColumn['formType']) && $settingColumn['formType'] == 'select'))
				{
					$multiOptions = array('' => 'LABEL_SELECT') + $multiOptions;
				}
				$settingColumn['options']['multiOptions'] = $multiOptions;

				if(isset($setting['otherMultioption']) && $setting['formType'] == 'multiCheckbox')
				{
					$settingColumn['options']['otherMultioption'] = $setting['otherMultioption'];
				}
			}

			if(isset($setting['hidden']) && $setting['hidden'] == true)
			{
				$settingColumn['options']['decorators'] = $form->hiddenDecorators;
				$settingColumn['type'] = 'hidden';
			}

			$elements[$column] = $settingColumn;
		}

		$form->setOptions([
			'elements' => $elements
		]);
		$form->setDisableLoadDefaultDecorators(true);

		return $form;
	}
871151
public function createAction()
    {
        $success = null;
        $this->paragraphLayout();

        /* @var $form \Zend\Form\Form */
        $request    = $this->getRequest();
        $data       = $request->getPost();
        $service    = $this->getServiceLocator();
        $model      = $service->get( 'Grid\User\Model\User\Model' );
        $form       = $service->get( 'Form' )
                              ->get( 'Grid\User\PasswordChangeRequest\Create' );

        if ( $request->isPost() )
        {
            $form->setData( $data );

            if ( $form->isValid() )
            {
                $data = $form->getData( 'email' );
                $user = $model->findByEmail( $data['email'] );

                if ( ! empty( $user ) &&
                     $user->state != UserStructure::STATE_BANNED )
                {
                    $change = $this->url()
                                   ->fromRoute( 'Grid\User\PasswordChangeRequest\Resolve', array(
                                       'locale' => (string) $this->locale(),
                                       'hash'   => $this->getServiceLocator()
                                                        ->get( 'Grid\User\Model\ConfirmHash' )
                                                        ->create( $user->email ),
                                   ) );

                    $this->getServiceLocator()
                         ->get( 'Grid\Mail\Model\Template\Sender' )
                         ->prepare( array(
                             'template' => 'user.forgotten-password',
                             'locale'   => $user->locale,
                         ) )
                         ->send( array(
                             'email'        => $user->email,
                             'display_name' => $user->displayName,
                             'change_url'   => $change,
                         ), array(
                             $user->email   => $user->displayName,
                         ) );

                    $success = true;
                }
                else
                {
                    $success = false;
                }
            }
            else
            {
                $success = false;
            }
        }

        /* Says success even if email does not exists */
        if ( $success === true || $success === false )
        {
            $this->messenger()
                 ->add( 'user.form.passwordRequest.success',
                        'user', Message::LEVEL_INFO );
        }

        return new MetaContent( 'user.passwordChangeRequest', array(
            'form' => $form,
        ) );
    }
516679
private function buildCreateForm()
    {
        $form = '';
        foreach ($this->fields as $field) {
            $title = addslashes($field->label);
            $key   = $field->title;
            if (in_array($field->validation, $this->starred)) {
                $title .= '*';
            }
            if ($field->type == 'relationship') {
                $key = $field->relationship_name . '_id';
            }
            $temp = file_get_contents(__DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'Templates' . DIRECTORY_SEPARATOR . 'fields' . DIRECTORY_SEPARATOR . $field->type);
            $temp = str_replace([
                '$LABEL$',
                '$TITLE$',
                '$VALUE$',
                '$STATE$',
                '$SELECT$',
                '$TEXTEDITOR$',
                '$HELPER$',
                '$WIDTH$',
                '$HEIGHT$',
            ], [
                $key,
                $title,
                $field->type != 'radio' ?
                    $field->value != '' ? ', ' . $field->value : ''
                    : "'$field->value'",
                $field->default,
                '$' . $field->relationship_name,
                $field->texteditor == 1 ? ' ckeditor' : '',
                $this->helper($field->helper),
                $field->dimension_w,
                $field->dimension_h,
            ], $temp);
            $form .= $temp;
        }
        $this->formFieldsCreate = $form;
    }
893322
public function createForm()
    {
        $this->collapse->childNodes->push(new Navbar\Form());

        return $this->form = $this->collapse->childNodes->last();
    }
294347
public function buildForm()
    {

        $this
            ->add($this->model->getKeyName(), 'hidden')
            ->add('libelle', 'text', [
                'validation' => 'required',
                'label'      => trans('expendable::form.subject')
            ])
            ->add('body_type', 'choice', [
                'choices'     => StaticLabel::bodyType(),
                'empty_value' => '-',
                'validation'  => 'required',
                'label'       => trans('expendable::form.body_type')
            ])
            ->add('action', 'choice', [
                'choices'     => StaticLabel::mailActions(),
                'empty_value' => '-',
                'validation'  => 'required',
                'label'       => trans('expendable::form.action')
            ])
            ->add('cc', 'tag', [
                'label' => trans('expendable::form.cc')
            ])
            ->add('bcc', 'tag', [
                'label' => trans('expendable::form.bcc')
            ])
            ->add('content', 'tinymce', [
                'validation' => 'required',
                'label'      => trans('expendable::form.content')
            ])
            ->add('status', 'choice', [
                'choices'     => StaticLabel::status(),
                'empty_value' => '-',
                'validation'  => 'required',
                'label'       => trans('expendable::form.status')
            ])
            ->addDefaultActions();
    }
691515
public function minify()
	{
		$data = '';

		foreach ($this->files as $fileData)
		{
			$fileData = $this->handleFile($fileData);

			$data .= $this->doMinify($fileData['content'], $fileData['options']);
		}

		return $data;
	}
1159604
protected function build()
    {
        $sql = "SELECT\n\t"
            . $this->columns . "\n"
            . $this->from . "\n"
            . ($this->join    ? $this->join           : null)
            . ($this->where   ? $this->where . "\n"   : null)
            . ($this->groupby ? $this->groupby . "\n" : null)
            . ($this->orderby ? $this->orderby . "\n" : null)
            . ($this->limit   ? $this->limit . "\n"   : null)
            . ($this->offset  ? $this->offset . "\n"  : null)
            . ";";

        return $sql;
    }
1253235
function createCreated() {
    if( !isset( $this->created['value']['year'] )  &&
        !isset( $this->created['value']['month'] ) &&
        !isset( $this->created['value']['day'] )   &&
        !isset( $this->created['value']['hour'] )  &&
        !isset( $this->created['value']['min'] )   &&
        !isset( $this->created['value']['sec'] ))
      return;
    $formatted  = $this->_format_date_time( $this->created['value'], 7 );
    $attributes = $this->_createParams( $this->created['params'] );
    return $this->_createElement( 'CREATED', $attributes, $formatted );
  }