Exemplo n.º 1
0
 /** {@inheritdoc} */
 public function init()
 {
     parent::init();
     $submit = new \Library\Form\Element\Submit('Submit');
     $submit->setLabel('OK');
     $this->add($submit);
 }
Exemplo n.º 2
0
 /** {@inheritdoc} */
 public function init()
 {
     parent::init();
     $this->_types = $this->getOption('customFieldManager')->getFields();
     $fields = new \Zend\Form\Fieldset('Fields');
     $inputFilterField = new \Zend\InputFilter\InputFilter();
     foreach ($this->_types as $name => $type) {
         if ($type == 'clob') {
             $element = new \Zend\Form\Element\Textarea($name);
         } else {
             $element = new \Zend\Form\Element\Text($name);
         }
         if ($name == 'TAG') {
             $element->setLabel('Category');
         } else {
             $element->setLabel($name);
         }
         $fields->add($element);
         $filter = array('name' => $name, 'required' => false, 'filters' => array(array('name' => 'Callback', 'options' => array('callback' => array($this, 'filterField'), 'callback_params' => $type))), 'validators' => array(array('name' => 'Callback', 'options' => array('callback' => array($this, 'validateField'), 'callbackOptions' => $type))));
         $inputFilterField->add($filter);
     }
     $this->add($fields);
     $submit = new \Library\Form\Element\Submit('Submit');
     $submit->setLabel('Change');
     $this->add($submit);
     $inputFilter = new \Zend\InputFilter\InputFilter();
     $inputFilter->add($inputFilterField, 'Fields');
     $this->setInputFilter($inputFilter);
 }
Exemplo n.º 3
0
 function init()
 {
     parent::init();
     $this->setLayout('reports\\productionform');
     $this->date_range_field = $this->addField('DateRangePicker', 'date_range')->setStartDate($this->app->now)->setEndDate($this->app->now)->getBackDatesSet();
     switch ($this->entity) {
         case 'customer':
             $this->addField('autocomplete/Basic', 'contact')->setModel('xepan\\base\\Contact');
             $this->layout->template->tryDel('department_wrapper');
             $this->layout->template->tryDel('outsourceparty_wrapper');
             break;
         case 'outsourceparty':
             $this->addField('autocomplete/Basic', 'outsource_party')->setModel('xepan\\production\\OutsourceParty');
             $this->layout->template->tryDel('department_wrapper');
             $this->layout->template->tryDel('contact_wrapper');
             break;
         default:
             $this->addField('autocomplete/Basic', 'department')->setModel('xepan\\hr\\Department');
             $this->layout->template->tryDel('contact_wrapper');
             $this->layout->template->tryDel('outsourceparty_wrapper');
             break;
     }
     if ($this->extra_fields) {
         $this->addField('xepan\\base\\DropDown', 'status')->setValueList($this->status_array)->setEmptyText('Please Select');
         $this->addField('xepan\\base\\DropDown', 'order')->setValueList(['desc' => 'Highest', 'asc' => 'Lowest'])->setEmptyText('Please Select');
     } else {
         $this->layout->template->tryDel('extra_field_wrapper');
     }
     $this->addSubmit('Filter')->addClass('btn btn-primary btn-block');
 }
Exemplo n.º 4
0
 /** {@inheritdoc} */
 public function init()
 {
     parent::init();
     $types = new \Zend\Form\Fieldset('Types');
     $this->add($types);
     $inputFilterTypes = new \Zend\InputFilter\InputFilter();
     $this->_definedTypes = $this->getOption('DeviceManager')->getTypeCounts();
     foreach ($this->_definedTypes as $name => $count) {
         $element = new \Zend\Form\Element\Text($name);
         $element->setValue($name);
         $types->add($element);
         $filter = array('name' => $name, 'required' => true, 'filters' => array(array('name' => 'StringTrim')), 'validators' => array(array('name' => 'StringLength', 'options' => array('min' => 1, 'max' => 255)), array('name' => 'Callback', 'options' => array('callback' => array($this, 'validateName'), 'callbackOptions' => $name, 'message' => $this->_('The name already exists')))));
         $inputFilterTypes->add($filter);
     }
     $add = new \Zend\Form\Element\Text('Add');
     $add->setLabel('Add');
     $this->add($add);
     $submit = new \Library\Form\Element\Submit('Submit');
     $submit->setLabel('Change');
     $this->add($submit);
     $inputFilter = new \Zend\InputFilter\InputFilter();
     $inputFilter->add($inputFilterTypes, 'Types');
     $inputFilter->add(array('name' => 'Add', 'required' => false, 'filters' => array(array('name' => 'StringTrim')), 'validators' => array(array('name' => 'StringLength', 'options' => array('max' => 255)), array('name' => 'Callback', 'options' => array('callback' => array($this, 'validateName'), 'message' => $this->_('The name already exists'))))));
     $this->setInputFilter($inputFilter);
 }
Exemplo n.º 5
0
 /** {@inheritdoc} */
 public function init()
 {
     parent::init();
     $translatedTypes = array('text' => $this->_('Text'), 'clob' => $this->_('Long text'), 'integer' => $this->_('Integer'), 'float' => $this->_('Float'), 'date' => $this->_('Date'));
     $fields = new \Zend\Form\Fieldset('Fields');
     $this->add($fields);
     $inputFilterFields = new \Zend\InputFilter\InputFilter();
     foreach ($this->getOption('CustomFieldManager')->getFields() as $name => $type) {
         if ($name == 'TAG') {
             // Static field, can not be edited
             continue;
         }
         $this->_definedFields[$name] = $translatedTypes[$type];
         $element = new \Zend\Form\Element\Text($name);
         $element->setValue($name);
         $fields->add($element);
         $filter = array('name' => $name, 'required' => true, 'filters' => array(array('name' => 'StringTrim')), 'validators' => array(array('name' => 'StringLength', 'options' => array('min' => 1, 'max' => 255)), array('name' => 'Callback', 'options' => array('callback' => array($this, 'validateName'), 'callbackOptions' => $name, 'message' => $this->_('The name already exists')))));
         $inputFilterFields->add($filter);
     }
     // Empty text field to create new field.
     $newName = new \Zend\Form\Element\Text('NewName');
     $newName->setLabel('Add');
     $this->add($newName);
     // Datatype of new field
     $newType = new \Zend\Form\Element\Select('NewType');
     $newType->setValueOptions($translatedTypes);
     $this->add($newType);
     $submit = new \Library\Form\Element\Submit('Submit');
     $submit->setLabel('Change');
     $this->add($submit);
     $inputFilter = new \Zend\InputFilter\InputFilter();
     $inputFilter->add($inputFilterFields, 'Fields');
     $inputFilter->add(array('name' => 'NewName', 'required' => false, 'filters' => array(array('name' => 'StringTrim')), 'validators' => array(array('name' => 'StringLength', 'options' => array('max' => 255)), array('name' => 'Callback', 'options' => array('callback' => array($this, 'validateName'), 'message' => $this->_('The name already exists'))))));
     $this->setInputFilter($inputFilter);
 }
Exemplo n.º 6
0
 /** {@inheritdoc} */
 public function init()
 {
     parent::init();
     $what = new \Zend\Form\Element\Radio('What');
     $what->setValueOptions(array(\Model\Client\Client::MEMBERSHIP_AUTOMATIC => $this->_('Store search parameters. Group memberships will be updated automatically.'), \Model\Client\Client::MEMBERSHIP_ALWAYS => $this->_('Add current search results. Group memberships will be set only this time.'), \Model\Client\Client::MEMBERSHIP_NEVER => $this->_('Exclude search results from a group.')));
     $what->setValue(\Model\Client\Client::MEMBERSHIP_AUTOMATIC);
     $this->add($what);
     $where = new \Zend\Form\Element\Radio('Where');
     $where->setValueOptions(array('new' => $this->_('Store in new group'), 'existing' => $this->_('Store in existing group')));
     $where->setValue('new')->setAttribute('onchange', 'selectElements()');
     $this->add($where);
     $newGroup = new \Zend\Form\Element\Text('NewGroup');
     $newGroup->setLabel('Name');
     $this->add($newGroup);
     $description = new \Zend\Form\Element\Text('Description');
     $description->setLabel('Description');
     $this->add($description);
     $existingGroup = new \Library\Form\Element\SelectSimple('ExistingGroup');
     $existingGroup->setLabel('Group');
     $groups = array();
     foreach ($this->getOption('GroupManager')->getGroups(null, null, 'Name') as $group) {
         $groups[] = $group['Name'];
     }
     $existingGroup->setValueOptions($groups);
     $this->add($existingGroup);
     $submit = new \Library\Form\Element\Submit('Submit');
     $submit->setLabel('OK');
     $this->add($submit);
     $inputFilter = new \Zend\InputFilter\InputFilter();
     $inputFilter->add(array('name' => 'NewGroup', 'continue_if_empty' => true, 'filters' => array(array('name' => 'StringTrim')), 'validators' => array(array('name' => 'Callback', 'options' => array('callback' => array($this, 'validateLength'), 'callbackOptions' => array(0, 255), 'message' => $this->_('The input is more than 255 characters long')), 'break_chain_on_failure' => true), array('name' => 'Callback', 'options' => array('callback' => array($this, 'validateLength'), 'callbackOptions' => array(1, 255), 'message' => "Value is required and can't be empty"), 'break_chain_on_failure' => true), array('name' => 'Callback', 'options' => array('callback' => array($this, 'validateGroupExists'), 'message' => $this->_('The name already exists'))))));
     $inputFilter->add(array('name' => 'Description', 'required' => false, 'filters' => array(array('name' => 'StringTrim'), array('name' => 'Null', 'options' => array('type' => 'string'))), 'validators' => array(array('name' => 'Callback', 'options' => array('callback' => array($this, 'validateLength'), 'callbackOptions' => array(0, 255), 'message' => $this->_('The input is more than 255 characters long'))))));
     $this->setInputFilter($inputFilter);
 }
Exemplo n.º 7
0
 function init()
 {
     parent::init();
     //$this->addField('line','test');
     $u = $this->addField('upload', 'file');
     $u->setController('Controller_Filestore_File');
     //$this->addSubmit('Upload');
 }
Exemplo n.º 8
0
 /** {@inheritdoc} */
 public function init()
 {
     parent::init();
     $this->setAttribute('method', 'GET');
     $filter = new \Zend\Form\Element\Select('filter');
     $filter->setLabel('Filter')->setValueOptions(array('accepted' => $this->_('selected for display'), 'ignored' => $this->_('ignored for display'), 'new' => $this->_('new or not categorized'), 'all' => $this->_('all')))->setAttribute('onchange', 'this.form.submit();');
     $this->add($filter);
 }
Exemplo n.º 9
0
 /**
  * Initialization
  *
  * Initialize login form fields with validators and decorators.
  *
  * @return void
  */
 public function init()
 {
     parent::init();
     $this->setName('login_form');
     $this->setMethod('post');
     $this->addElement('text', 'foo', array());
     $this->addElement('text', 'bar', array());
     $this->addElement('text', 'baz', array());
 }
Exemplo n.º 10
0
 function init()
 {
     parent::init();
     $this->config = Config::getInstance();
     $this->namespace = __NAMESPACE__;
     $public_location = $this->app->pathfinder->addLocation(array('js' => array('packages/' . str_replace(['\\', '/'], '_', $this->namespace) . '/js'), 'css' => array('packages/' . str_replace(['\\', '/'], '_', $this->namespace) . '/css')))->setBasePath(getcwd() . '/public')->setBaseURL($this->app->getBaseURL());
     $this->js(true)->_load('atk4_messages');
     $private_location = $this->app->pathfinder->addLocation(array('addons' => array('../vendor/atk4')))->setBasePath('.');
 }
 static function registerForm(Form $form)
 {
     self::$forms[$form->getName()] = $form;
     if (@$_REQUEST[FormSigner::ID_ELT] === $form->getName()) {
         $form->call(self::getSigner());
         return true;
     } else {
         $form->init();
     }
     return false;
 }
Exemplo n.º 12
0
    function init(){
        parent::init();
        $f=$this;

        $f->addField('line','name')->validateNotNull()
            ->setFieldHint('Click "Register" to see error');
        $f->addField('line','email')
            ->validateNotNull()
            ->validateField('filter_var($this->get(), FILTER_VALIDATE_EMAIL)')
            ;

        $f->addField('password','password')->validateNotNull()
            ->setProperty('max-length',30)->setFieldHint('30 characters maximum');

        $p2=$f->addField('password','password2')
            ->validateField('$this->get()==$this->owner->getElement("password")->get()',
                    'Passwords do not match');




        $f->addSeparator();

        $f->addField('DatePicker','date_birth','Birthdate');

        $f->addField('dropdown','age')
            ->setValueList(array('','11 - 20', '21 - 30', '31 - 40'));

        $f->addField('text','about')
            ->setProperty('cols',45)->setProperty('rows','5')
            ->validateField('5000>=strlen($this->get())','Too long');

        $f->addSeparator();

        $f->addField('radio','sex')
            ->setValueList(array('m'=>'Male','f'=>'Female'))
            ;  // automatically validated to be one of value list



        $f->addField('checkbox','agreeRules','I Agree to Rules and Terms'
                )->validateNotNull('You must agree to the rules');


        $js=array();
        $this->js()->atk4_form('fieldError','password2','Passwords do not match');
        $this->js()->atk4_form('fieldError','age','Age is not entered - sample longer error which may span');
        $this->js()->atk4_form('fieldError','about','Sample error on textarea field');


        $f->addSubmit('Submit');
        $f->addSubmit('Show More Errors');

    }
Exemplo n.º 13
0
 function init()
 {
     parent::init();
     $this->addSubmit('Save');
     $f = $this;
     $this->api->addHook('post-init', function () use($f) {
         if ($f->isSubmitted()) {
             $f->update();
             $f->js()->univ()->successMessage('Saved')->execute();
         }
     });
 }
Exemplo n.º 14
0
 function init()
 {
     parent::init();
     $this->addField('line', 'email', 'E-Mail')->addField('password', 'clear', 'Password')->addField('line', 'name', 'Full Name')->addField('line', 'relocated_to', 'Relocate to')->addField('line', 'forward_to', 'Forward to')->addField('line', 'cc_to', 'Send copy to');
     if ($this->api->getUserLevel() == 99) {
         $this->addField('text', 'domains', 'Trusted domains')->addField('dropdown', 'access_level', 'Access Level')->setValueList(array(0 => 'Self only', 9 => 'Maintain', 99 => 'Admin'));
     }
     $this->addSubmit('Save');
     if ($this->api->getUserLevel() == 99 && $_GET['id'] != '') {
         $this->addSubmit('Delete');
     }
     $this->setSource('users')->addConditionFromGET('id');
 }
Exemplo n.º 15
0
 /** {@inheritdoc} */
 public function init()
 {
     parent::init();
     $deleteInterfaces = new \Zend\Form\Element\Checkbox('DeleteInterfaces');
     $deleteInterfaces->setLabel('Delete interfaces from network listing')->setChecked($this->getOption('config')->defaultDeleteInterfaces);
     $this->add($deleteInterfaces);
     $yes = new \Library\Form\Element\Submit('yes');
     $yes->setLabel('Yes');
     $this->add($yes);
     $no = new \Library\Form\Element\Submit('no');
     $no->setLabel('No');
     $this->add($no);
 }
Exemplo n.º 16
0
 /** {@inheritdoc} */
 public function init()
 {
     parent::init();
     $name = new \Zend\Form\Element\Text('Name');
     $name->setLabel('Name');
     $this->add($name);
     $submit = new \Library\Form\Element\Submit('Submit');
     $submit->setLabel('OK');
     $this->add($submit);
     $inputFilter = new \Zend\InputFilter\InputFilter();
     $inputFilter->add(array('name' => 'Name', 'required' => false, 'filters' => array(array('name' => 'StringTrim')), 'validators' => array(array('name' => 'StringLength', 'options' => array('max' => 255)))));
     $this->setInputFilter($inputFilter);
 }
Exemplo n.º 17
0
 /** {@inheritdoc} */
 public function init()
 {
     parent::init();
     $key = new \Zend\Form\Element\Text('Key');
     $key->setLabel('Product key (if different)');
     $this->add($key);
     $submit = new \Library\Form\Element\Submit('Submit');
     $submit->setLabel('OK');
     $this->add($submit);
     $inputFilter = new \Zend\InputFilter\InputFilter();
     $inputFilter->add(array('name' => 'Key', 'required' => false, 'filters' => array(array('name' => 'StringTrim'), array('name' => 'StringToUpper')), 'validators' => array(array('name' => 'Library\\Validator\\ProductKey'))));
     $this->setInputFilter($inputFilter);
 }
Exemplo n.º 18
0
 /** {@inheritdoc} */
 public function init()
 {
     parent::init();
     $file = new \Zend\Form\Element\File('File');
     $file->setLabel('File (*.ocs, *.xml)');
     $this->add($file);
     $submit = new \Library\Form\Element\Submit('Submit');
     $submit->setLabel('Import');
     $this->add($submit);
     $inputFilter = new \Zend\InputFilter\InputFilter();
     $inputFilter->add(array('name' => 'File'));
     // Sufficient to force uploaded file
     $this->setInputFilter($inputFilter);
 }
Exemplo n.º 19
0
 /** {@inheritdoc} */
 public function init()
 {
     parent::init();
     $type = new \Library\Form\Element\SelectSimple('Type');
     $type->setLabel('Type')->setValueOptions($this->getOption('DeviceManager')->getTypes());
     $this->add($type);
     $description = new \Zend\Form\Element\Text('Description');
     $description->setLabel('Description');
     $this->add($description);
     $submit = new \Library\Form\Element\Submit('Submit');
     $submit->setLabel('OK');
     $this->add($submit);
     $inputFilter = new \Zend\InputFilter\InputFilter();
     $inputFilter->add(array('name' => 'Description', 'required' => false, 'filters' => array(array('name' => 'StringTrim')), 'validators' => array(array('name' => 'StringLength', 'options' => array('max' => 255)))));
     $this->setInputFilter($inputFilter);
 }
Exemplo n.º 20
0
 /**
  * Control Panel
  */
 public function admin()
 {
     $form = new Form("Wysiwyg.config");
     $options = new Core_ArrayObject();
     $options->editor = config('wysiwyg.editor');
     $form->init();
     $form->elements->type->setValues(self::$editors);
     $form->object($options);
     if ($result = $form->result()) {
         if (isset(self::$editors[$result['type']])) {
             cogear()->set('wysiwyg.editor', $result['type']);
             success('Configuration saved successfully.');
         }
     }
     append('content', $form->render());
 }
Exemplo n.º 21
0
 function init()
 {
     parent::init();
     $this->setLayout('reports\\form');
     $this->date_range_field = $this->addField('DateRangePicker', 'date_range')->setStartDate($this->app->now)->setEndDate($this->app->now)->getBackDatesSet();
     $this->addField('autocomplete/Basic', 'contact')->setModel('xepan\\base\\Contact');
     $this->addField('from_amount');
     $this->addField('to_amount');
     if ($this->extra_field) {
         $this->addField('xepan\\base\\DropDown', 'status')->setValueList($this->status_array)->setEmptyText('Please Select');
         $this->addField('xepan\\base\\DropDown', 'order')->setValueList(['desc' => 'Highest', 'asc' => 'Lowest'])->setEmptyText('Please Select');
     } else {
         $this->layout->template->tryDel('extra_field_wrapper');
     }
     $this->addSubmit('Filter')->addClass('btn btn-primary btn-block');
 }
Exemplo n.º 22
0
 /** {@inheritdoc} */
 public function init()
 {
     parent::init();
     $user = new \Zend\Form\Element\Text('User');
     $user->setLabel('Username');
     $this->add($user);
     $password = new \Zend\Form\Element\Password('Password');
     $password->setLabel('Password');
     $this->add($password);
     $submit = new \Library\Form\Element\Submit('Submit');
     $submit->setLabel('Login');
     $this->add($submit);
     $inputFilter = $this->getInputFilter();
     $inputFilter->get('User')->setAllowEmpty(true);
     $inputFilter->get('Password')->setAllowEmpty(true);
 }
Exemplo n.º 23
0
 function init()
 {
     parent::init();
     if (isset($_GET['rvadym_gmap_action']) && $_GET['rvadym_gmap_action'] == 'getAddress') {
         echo json_encode($this->getCoordByAddr($_GET['addr']));
         exit;
     }
     if (isset($this->form_config['map_fields'])) {
         $this->prepareFieldsNames();
     }
     if ($this->form_config['location'] == true) {
         $this->addLocation();
     }
     if ($this->form_config['draw'] == true) {
         $this->addDraw();
     }
     $this->namespace = __NAMESPACE__;
     $public_location = $this->app->pathfinder->addLocation(array('js' => array('packages/' . str_replace(['\\', '/'], '_', $this->namespace) . '/js'), 'css' => array('packages/' . str_replace(['\\', '/'], '_', $this->namespace) . '/css')))->setBasePath(getcwd() . '/public')->setBaseURL($this->app->url('/'));
 }
Exemplo n.º 24
0
 function init()
 {
     parent::init();
     $this->js_widget = null;
     $this->api->addHook('post-init', array($this, 'recallAll'));
 }
Exemplo n.º 25
0
<?php

require "Form.php";
$form = new Form();
echo $form->init();
echo $form->jeux('Halo', 'LogoHalo.png');
echo $form->jeux('Dragon Age Inquisition', 'LogoDragon.jpg');
/**
 * Created by PhpStorm.
 * User: erwan
 * Date: 02/12/2015
 * Time: 23:06
 */
Exemplo n.º 26
0
 function init()
 {
     parent::init();
 }
Exemplo n.º 27
0
 function init()
 {
     parent::init();
     // set default values on non-yet initialized fields
     $this->api->addHook('post-init', array($this, 'postInit'));
 }
Exemplo n.º 28
0
 function init()
 {
     parent::init();
     //        $this->add('\\rvadym\\x_tinymce\\Controller_TinyMCE');
     $this->addField('Text', 'text');
 }
 /**
  * @param array $fields_form
  * @param array $fields_value
  * @param \Module $module
  *
  * @return string
  *
  * @author Panagiotis Vagenas <*****@*****.**>
  * @since ${VERSION}
  */
 public function generateForm($fields_form = array(), $fields_value = array(), \Module $module = null)
 {
     if ((empty($fields_form) || empty($fields_value) || empty($module)) && $this->initialized) {
         return parent::generate();
     } else {
         $form = new Form($module);
         $form->init($module);
         $this->setFieldsForm($fields_form)->setFieldsValue($fields_value);
         return $form->generate();
     }
 }
Exemplo n.º 30
0
 function init()
 {
     parent::init();
     $edit_model = $this->add('xepan\\communication\\Model_Communication_Abstract_Email');
     $edit_task_model = $this->add('xepan\\projects\\Model_Task');
     if ($this->edit_communication_id) {
         $edit_model->load($this->edit_communication_id);
         $edit_task_model->tryLoadBy('related_id', $edit_model->id);
     }
     $this->addClass('form-communication');
     $this->setLayout('view\\communicationform');
     $type_field = $this->addField('dropdown', 'type');
     $type_field->setValueList(['Email' => 'Email', 'Call' => 'Call', 'TeleMarketing' => 'TeleMarketing', 'Personal' => 'Personal', 'Comment' => 'Comment', 'SMS' => 'SMS']);
     $type_field->set($edit_model['communication_type']);
     $config_m = $this->add('xepan\\base\\Model_ConfigJsonModel', ['fields' => ['sub_type' => 'text'], 'config_key' => 'COMMUNICATION_SUB_TYPE', 'application' => 'Communication']);
     $config_m->tryLoadAny();
     $sub_type_array = explode(",", $config_m['sub_type']);
     $sub_type_field = $this->addField('dropdown', 'sub_type')->set($edit_model['sub_type'])->setEmptyText('Please Select');
     $sub_type_field->setValueList(array_combine($sub_type_array, $sub_type_array));
     if ($this->app->auth->model->isSuperUser()) {
         $date_field = $this->addField('DateTimePicker', 'date')->set($edit_model['created_at']);
     }
     $status_field = $this->addField('dropdown', 'status')->set($edit_model['status']);
     $status_field->setValueList(['Called' => 'Called', 'Received' => 'Received'])->setEmptyText('Please Select');
     $this->addField('title')->validate('required')->set($edit_model['title']);
     $this->addField('xepan\\base\\RichText', 'body')->validate('required')->set($edit_model['description']);
     $from_email = $this->addField('dropdown', 'from_email')->setEmptyText('Please Select From Email');
     $my_email = $this->add('xepan\\hr\\Model_Post_Email_MyEmails');
     $from_email->setModel($my_email);
     $email_setting = $this->add('xepan\\communication\\Model_Communication_EmailSetting');
     if ($edit_model['from_raw']) {
         $email_setting->tryLoadBy('email_username', $edit_model['from_raw']['email']);
         $from_email->set($email_setting->id);
     }
     // $email_setting=$this->add('xepan\communication\Model_Communication_EmailSetting');
     if ($_GET['from_email']) {
         $email_setting->tryLoad($_GET['from_email']);
     }
     $view = $this->layout->add('View', null, 'signature')->setHTML($email_setting['signature']);
     $from_email->js('change', $view->js()->reload(['from_email' => $from_email->js()->val()]));
     $notify_email = $this->addField('Checkbox', 'notify_email', '');
     $notify_email_to = $this->addField('line', 'notify_email_to');
     $email_to_field = $this->addField('line', 'email_to');
     $cc_email_field = $this->addField('line', 'cc_mails');
     $bcc_email_field = $this->addField('line', 'bcc_mails');
     if ($edit_model['cc_raw']) {
         $edit_emails_cc = [];
         foreach ($edit_model['cc_raw'] as $flipped) {
             $edit_emails_cc[] = $flipped['email'];
         }
         $cc_email_field->set(implode(", ", $edit_emails_cc));
     }
     if ($edit_model['bcc_raw']) {
         $edit_emails_bcc = [];
         foreach ($edit_model['bcc_raw'] as $flipped) {
             $edit_emails_bcc[] = $flipped['email'];
         }
         $bcc_email_field->set(implode(", ", $edit_emails_bcc));
     }
     $this->addField('line', 'from_phone')->set($edit_model['from_raw']['number']);
     $emp_field = $this->addField('DropDown', 'from_person');
     $emp_model = $this->add('xepan\\hr\\Model_Employee');
     if ($edit_model['from_id']) {
         $emp_model->load($edit_model['from_id']);
         $emp_field->set($emp_model->id);
     } else {
         $emp_field->set($this->app->employee->id);
     }
     $emp_field->setModel($emp_model);
     $this->addField('line', 'called_to')->set($edit_model['to_raw'][0]['number']);
     $this->addField('line', 'from_number');
     //->set($edit_model['from_raw']['number']);
     $this->addField('line', 'sms_to');
     $follow_up_field = $this->addField('DropDown', 'follow_up')->setValueList(['Yes' => 'Yes', 'No' => 'No'])->setEmptyText('Want to follow-up ?');
     $follow_up_by_field = $this->addField('DropDown', 'follow_up_type')->setValueList(['Task' => 'Task', 'Reminder' => 'Reminder']);
     $task_title_field = $this->addField('task_title');
     $starting_date_field = $this->addField('DateTimePicker', 'starting_at')->set($this->app->now);
     $assign_to_field = $this->addField('DropDown', 'assign_to');
     $assign_to_field->setModel('xepan\\hr\\Model_Employee');
     $assign_to_field->set($this->app->employee->id);
     $description_field = $this->addField('text', 'description');
     $remind_via_field = $this->addField('DropDown', 'remind_via')->setValueList(['Email' => 'Email', 'SMS' => 'SMS', 'Notification' => 'Notification'])->setAttr(['multiple' => 'multiple']);
     $notify_to_field = $this->addField('DropDown', 'notify_to')->setAttr(['multiple' => 'multiple']);
     $notify_to_field->setModel('xepan\\hr\\Model_Employee');
     $remind_value_field = $this->addField('remind_value')->set(0);
     $remind_unit_field = $this->addField('DropDown', 'remind_unit')->setValueList(['Minutes' => 'Minutes', 'hours' => 'Hours', 'day' => 'Days', 'Weeks' => 'Weeks', 'months' => 'Months']);
     if ($edit_task_model->loaded()) {
         $task_title_field->set($edit_task_model['task_name']);
         $starting_date_field->set($edit_task_model['starting_date']);
         $assign_to_field->set($edit_task_model['assign_to_id']);
         $description_field->set($edit_task_model['description']);
         $remind_via_field->set($edit_task_model['task_name']);
         $notify_to_field->set($edit_task_model['task_name']);
         $remind_value_field->set($edit_task_model['remind_value']);
         $remind_unit_field->set($edit_task_model['remind_unit']);
         $temp = [];
         $temp = explode(',', $edit_task_model['notify_to']);
         $temp1 = [];
         $temp1 = explode(',', $edit_task_model['remind_via']);
         $notify_to_field->set($temp)->js(true)->trigger('changed');
         $remind_via_field->set($temp1)->js(true)->trigger('changed');
     }
     $type_field->js(true)->univ()->bindConditionalShow(['Email' => ['from_email', 'email_to', 'cc_mails', 'bcc_mails'], 'Call' => ['from_email', 'from_phone', 'from_person', 'called_to', 'notify_email', 'notify_email_to', 'status'], 'TeleMarketing' => ['from_phone', 'called_to'], 'Personal' => ['from_person'], 'Comment' => ['from_person'], 'SMS' => ['from_number', 'sms_to']], 'div.atk-form-row');
     $follow_up_field->js(true)->univ()->bindConditionalShow(['Yes' => ['follow_up_type', 'task_title', 'starting_at', 'assign_to', 'description']], 'div.atk-form-row');
     $follow_up_by_field->js(true)->univ()->bindConditionalShow(['Reminder' => ['remind_via', 'notify_to', 'remind_value', 'remind_unit']], 'div.atk-form-row');
     // $notify_email->js(true)->univ()->bindConditionalShow([
     // 	'Phone'=>['notify_email_to'],
     // ],'div.atk-form-row');
     $this->addHook('validate', [$this, 'validateFields']);
 }