Esempio n. 1
0
 function correct($k, &$v)
 {
     if ($this->_key === 'field') {
         $t = $v;
         $v = new Zkernel_Config_Control(array('stype' => '', 'editoptions' => '', 'required' => false, 'type' => 'text', 'align' => '', 'width' => '', 'description' => '', 'sortable' => false, 'active' => $k != 'lang' && $k != 'parentid' && $k != 'orderid' && $k != 'id' && !preg_match('/^ml\\_[^\\_]+\\_[\\d]+$/i', $k), 'name' => $k, 'title' => $k == 'title' ? 'Название' : $k, 'hidden' => false, 'live' => false, 'formatter' => '', 'formatoptions' => '', 'param' => array(), 'order' => 1000));
         $v->set($t);
     } else {
         if ($this->_key === 'button_top' || $this->_key === 'button_bottom') {
             if (is_string($v)) {
                 $action = 'ctl' . $v;
                 $default = 0;
                 $inner = 0;
                 $confirm = (int) ($v == 'delete');
                 $param = '';
                 $field = '';
                 $cl = 't';
             } else {
                 $action = $v->action;
                 $default = (int) $v->default;
                 $inner = (int) $v->inner;
                 $confirm = (int) $v->confirm;
                 $param = $v->param;
                 $cl = @$v->cl ? $v->cl : 't';
                 $controller = $v->controller;
                 $field = $v->field;
             }
             if (!@$controller) {
                 $controller = Zend_Controller_Front::getInstance()->getRequest()->getControllerName();
             }
             if (is_object($v) && $v->title) {
                 $title = $v->title;
             } else {
                 switch ($action) {
                     case 'ctladd':
                         $title = '_lang_add';
                         break;
                     case 'ctledit':
                         $title = '_lang_edit';
                         break;
                     case 'ctldelete':
                         $title = '_lang_delete';
                         break;
                 }
             }
             $v = new Zkernel_Config_Control(array('cl' => $cl, 'title' => @$title, 'controller' => $controller, 'action' => $action, 'param' => $param, 'default' => $default, 'inner' => $inner, 'confirm' => $confirm, 'field' => $field));
         } else {
             if ($k === 'static_field' && $v) {
                 $t = $v;
                 $v = new Zkernel_Config_Control(array('field_src' => 'title', 'field_dst' => 'stitle', 'unique' => true, 'length' => 20));
                 if ($t instanceof Zkernel_Config_Control) {
                     $v->set($t);
                 }
             }
         }
     }
 }