Exemple #1
0
    public function __toString()
    {
        $this->_convertListeners();
        $combo = Ext_Factory::object('Form_Field_Combobox');
        $combo->setName($this->getName());
        Ext_Factory::copyProperties($this, $combo);
        if ($this->isValidProperty('dictionary') && strlen($this->dictionary)) {
            $dM = new Dictionary_Manager();
            if ($dM->isValidDictionary($this->dictionary)) {
                $allowBlank = false;
                if ($this->_config->allowBlank && !$this->_config->showAll) {
                    $allowBlank = true;
                }
                if ($this->_config->isValidProperty('showAll') && !empty($this->_config->showAllText)) {
                    $allText = $this->_config->showAllText;
                } else {
                    $allText = false;
                }
                $data = Dictionary::getInstance($this->dictionary)->__toJs($this->_config->showAll, $allowBlank, $allText);
                if (strlen($data)) {
                    $combo->store = 'Ext.create("Ext.data.Store",{
					        model:"app.comboStringModel",
					        data: ' . $data . '
						 })';
                }
            }
        }
        return $combo->getConfig()->__toString();
    }
Exemple #2
0
 /**
  * Change field type
  */
 public function changetypeAction()
 {
     $this->_checkLoaded();
     $object = $this->_getObject();
     $column = $this->_getColumn();
     $type = Request::post('type', 'string', false);
     $adapter = Request::post('adapter', 'string', false);
     $dictionary = Request::post('dictionary', 'string', false);
     if ($type === 'Form_Field_Adapter') {
         $newObject = Ext_Factory::object($adapter);
         /*
          * Invalid adapter
          */
         if (!$adapter || !strlen($adapter) || !class_exists($adapter)) {
             Response::jsonError($this->_lang->INVALID_VALUE, array('adapter' => $this->_lang->INVALID_VALUE));
         }
         if ($adapter === 'Ext_Component_Field_System_Dictionary') {
             /*
              * Inavalid dictionary
              */
             if (!$dictionary || !strlen($dictionary)) {
                 Response::jsonError($this->_lang->INVALID_VALUE, array('dictionary' => $this->_lang->INVALID_VALUE));
             }
             $newObject->dictionary = $dictionary;
         }
     } else {
         $newObject = Ext_Factory::object($type);
         /*
          * No changes
          */
         if ($type === $object->getClass()) {
             Response::jsonSuccess();
         }
     }
     Ext_Factory::copyProperties($object, $newObject);
     $newObject->setName($object->getName());
     $this->_getProject()->getEventManager()->removeObjectEvents($newObject->getName());
     $this->_setEditor($newObject);
     $this->_storeProject();
     Response::jsonSuccess();
 }
Exemple #3
0
 /**
  * Change grid column type
  */
 public function changecoltypeAction()
 {
     $type = Request::post('type', 'string', '');
     $columnId = Request::post('columnId', 'string', false);
     if (!$columnId) {
         Response::jsonError($this->_lang->WRONG_REQUEST);
     }
     if (strlen($type)) {
         $name = 'Grid_Column_' . ucfirst($type);
     } else {
         $name = 'Grid_Column';
     }
     $col = Ext_Factory::object($name);
     Ext_Factory::copyProperties($this->_object->getColumn($columnId), $col);
     if (!$this->_object->updateColumn($columnId, $col)) {
         Response::jsonError($this->_lang->WRONG_REQUEST);
     }
     $this->_storeProject();
     Response::jsonSuccess();
 }
Exemple #4
0
 /**
  * Change grid filter type
  */
 public function changefiltertypeAction()
 {
     $type = Request::post('type', 'string', '');
     $filterId = Request::post('filterid', 'pagecode', false);
     if (!$filterId) {
         Response::jsonError($this->_lang->WRONG_REQUEST);
     }
     if (strlen($type)) {
         $name = 'Grid_Filter_' . ucfirst($type);
     } else {
         $name = 'Grid_Filter_String';
     }
     $oldFilter = $this->_object->getFiltersFeature()->getFilter($filterId);
     $newFilter = Ext_Factory::object($name);
     Ext_Factory::copyProperties($oldFilter, $newFilter);
     $newFilter->setName($oldFilter->getName());
     switch ($type) {
         case 'date':
             if (empty($newFilter->dateFormat)) {
                 $newFilter->dateFormat = "Y-m-d";
             }
             if (empty($newFilter->afterText)) {
                 $newFilter->afterText = '[js:] appLang.FILTER_AFTER_TEXT';
             }
             if (empty($newFilter->beforeText)) {
                 $newFilter->beforeText = '[js:] appLang.FILTER_BEFORE_TEXT';
             }
             if (empty($newFilter->onText)) {
                 $newFilter->onText = '[js:] appLang.FILTER_ON_TEXT';
             }
             break;
         case 'datetime':
             if (empty($newFilter->dateFormat)) {
                 $newFilter->dateFormat = "Y-m-d";
             }
             $newFilter->date = '{format: "Y-m-d"}';
             $newFilter->time = '{format: "H:i:s",increment:1}';
             if (empty($newFilter->afterText)) {
                 $newFilter->afterText = '[js:] appLang.FILTER_AFTER_TEXT';
             }
             if (empty($newFilter->beforeText)) {
                 $newFilter->beforeText = '[js:] appLang.FILTER_BEFORE_TEXT';
             }
             if (empty($newFilter->onText)) {
                 $newFilter->onText = '[js:] appLang.FILTER_ON_TEXT';
             }
             break;
         case 'list':
             $newFilter->phpMode = true;
             break;
         case 'boolean':
             $newFilter->noText = '[js:] appLang.NO';
             $newFilter->yesText = '[js:] appLang.YES';
             break;
     }
     if (!$this->_object->getFiltersFeature()->setFilter($filterId, $newFilter)) {
         Response::jsonError($this->_lang->WRONG_REQUEST);
     }
     $this->_storeProject();
     Response::jsonSuccess();
 }