Exemple #1
0
 public function getSearchSQL()
 {
     $value = parent::getSearchValue();
     if (!empty($value) && $value == 'off') {
         return $this->getName() . "=''";
     } else {
         return parent::getSearchSQL();
     }
 }
Exemple #2
0
 /**
  * Converts the value into text, ready for the control to display
  * @return \snb\form\FormView
  */
 public function getView()
 {
     $view = parent::getView();
     // Need to convert the date time object to text
     $date = $view->get('value');
     if ($date instanceof \DateTime) {
         $format = $view->get('format', 'j M Y');
         $view->set('value', $date->format($format));
     }
     return $view;
 }
Exemple #3
0
 public function getSearchURL()
 {
     $ret = '';
     if (parent::getSearchURL('beg')) {
         $ret = parent::getSearchURL('beg');
     }
     if (parent::getSearchURL('end')) {
         $ret = ($ret ? '&' : '') . parent::getSearchURL('end');
     }
     return $ret;
 }
Exemple #4
0
 public function getStatic()
 {
     $ret = '';
     $fields = explode(',', $this->props['l_field']);
     $items = $GLOBALS['db']->getItems('select_list_static', 'SELECT id,' . $this->props['l_field'] . ' FROM ' . $this->props['l_table'] . ' WHERE id IN(' . parent::getStatic() . ')' . ($this->props['l_sort'] ? ' ORDER BY ' . $this->props['l_sort'] : ''));
     foreach ($items as $k => $a) {
         $ret .= '';
         $ret .= !empty($ret) && $k ? ', ' : '';
         foreach ($fields as $fi) {
             $ret .= !empty($a[$fi]) ? ' ' . $a[$fi] : '';
         }
         $ret .= ' [' . $a['id'] . ']';
     }
     return $ret;
 }
 public function setplaceAction()
 {
     $this->view->setRenderLevel(View::LEVEL_ACTION_VIEW);
     if (is_numeric($this->request->getPost('cat_id')) && $this->request->hasPost('cat_id') && $this->request->isAjax()) {
         $cat_id = $this->request->getPost('cat_id');
         foreach (FieldType::find() as $fl) {
             if ($fl->id == 4) {
                 $field[$fl->id] = array($fl->name, $fl->dtype, $fl->pref);
             }
         }
         if (!$this->request->hasPost('sub')) {
             foreach (Categories::find(array("id ={$cat_id} or id_sub ={$cat_id}")) as $categ) {
                 foreach ($categ->fieldtype as $fil) {
                     if (strpos($fil->dtype, "a:") !== false) {
                         $field[$fil->id] = array($fil->name, unserialize($fil->dtype), $fil->pref);
                     } else {
                         $field[$fil->id] = array($fil->name, $fil->dtype, $fil->pref);
                     }
                 }
             }
         } else {
             $ct = Categories::findFirst($cat_id)->id_sub;
             foreach (Categories::find(array("id ={$ct} or id ={$cat_id}")) as $categ) {
                 foreach ($categ->fieldtype as $fil) {
                     if (strpos($fil->dtype, "a:") !== false) {
                         $field[$fil->id] = array($fil->name, unserialize($fil->dtype), $fil->pref);
                     } else {
                         $field[$fil->id] = array($fil->name, $fil->dtype, $fil->pref);
                     }
                 }
             }
         }
         $this->view->setVars(array('field' => $field = isset($field) ? $field : false));
     } else {
         $this->view->setVars(array('field' => $field = isset($field) ? $field : false));
     }
 }
Exemple #6
0
 public function __construct(&$props, $dbArray = null)
 {
     parent::__construct($props, $dbArray);
     $this->dbValue = str_replace("'", '`', $this->dbValue);
 }
 public function redofferAction()
 {
     $this->view->setRenderLevel(View::LEVEL_ACTION_VIEW);
     if ($this->request->hasPost('offer_id')) {
         foreach (FieldType::find() as $field) {
             $fil[$field->id] = $field->name;
         }
         $offer = Offers::findFirst($this->request->getPost('offer_id'));
         foreach ($offer->dannoffers as $dan) {
             $dan_fil[$dan->fieldtype->id] = $dan->dann;
         }
         $cat = $offer->categories;
         $cat_id = $cat->id;
         foreach (Categories::find(array("id_sub =0")) as $categ) {
             $category[$categ->id] = $categ->name;
         }
         // Получение родительской категории
         if (count(Categories::find(array("id_sub = {$cat->id}"))) > 0) {
             foreach (Categories::find(array("id_sub = {$cat->id}")) as $categ) {
                 $sub_cat[$categ->id] = $categ->name;
             }
         } else {
             foreach (Categories::find(array("id = {$cat->id_sub}")) as $categ) {
                 $par_cat = $categ->id;
                 foreach (Categories::find(array("id_sub = {$categ->id}")) as $cate) {
                     $sub_cat[$cate->id] = $cate->name;
                 }
             }
         }
         if (count(Categories::find(array("id = {$cat->id_sub}"))) > 0) {
             foreach (Categories::findFirst(array("id = {$cat->id_sub}"))->fieldtype as $cat_field) {
                 $cat_fd[$cat_field->id] = array($cat_field->name, $cat_field->pref, $cat_field->dtype);
             }
         }
         foreach ($cat->fieldtype as $cat_field) {
             $cat_f[$cat_field->id] = array($cat_field->name, $cat_field->pref, $cat_field->dtype);
         }
         //  $this->elements->var_print($dan_fil);
         if (!isset($sub_cat)) {
             $par_cat = $cat_id;
         }
         $this->view->setVars(array('field' => $fil, 'cat_field' => $cat_f = isset($cat_f) ? $cat_f : false, 'cat_fieldf' => $cat_fd = isset($cat_fd) ? $cat_fd : false, 'offer_name' => $offer_name = isset($offer->name) ? $offer->name : false, 'offer_text' => $off = isset($offer->text) ? $offer->text : false, 'offer_id' => $off = isset($offer->id) ? $offer->id : false, 'dan_fil' => $dan_fil = isset($dan_fil) ? $dan_fil : false, 'par_cat' => $par_cat = isset($par_cat) ? $par_cat : false, 'cat_id' => $cat_id = isset($cat_id) ? $cat_id : false, 'cat' => $category = isset($category) ? $category : false, 'sub_cat' => $sub_cat = isset($sub_cat) ? $sub_cat : false));
     }
 }
 /**
  * @param array $aConfig
  *
  * @return $this
  * @throws \Exception
  */
 public function parseFieldTypeArray(array $aConfig)
 {
     $fieldType = new FieldType();
     $fieldType->exchangeArray($aConfig);
     return $fieldType;
 }
 public function __construct()
 {
     $this->type = 'radio';
     parent::__construct();
 }
 public function __construct()
 {
     $this->type = 'number';
     parent::__construct();
 }
 public function __construct()
 {
     $this->type = 'text';
     parent::__construct();
 }
 public function __construct()
 {
     $this->type = 'checkbox';
     parent::__construct();
 }
 /**
  * @since 2.5
  *
  * {@inheritDoc}
  */
 public function getStandardFieldType($fieldType)
 {
     $fieldTypes = array('id' => 'INT(8) UNSIGNED', 'id primary' => 'INT(8) UNSIGNED NOT NULL KEY AUTO_INCREMENT', 'namespace' => 'INT(11)', 'title' => 'VARBINARY(255)', 'interwiki' => 'VARBINARY(32)', 'iw' => 'VARBINARY(32)', 'blob' => 'MEDIUMBLOB', 'text' => 'TEXT', 'boolean' => 'TINYINT(1)', 'double' => 'DOUBLE', 'integer' => 'INT(8)', 'char nocase' => 'VARCHAR(255) CHARSET utf8 COLLATE utf8_general_ci', 'usage count' => 'INT(8) UNSIGNED', 'integer unsigned' => 'INT(8) UNSIGNED');
     return FieldType::mapType($fieldType, $fieldTypes);
 }
Exemple #14
0
 public function getSearchInput()
 {
     $value = '';
     return $this->colorFieldType_getInput(parent::getSearchName(), $value, false);
 }
Exemple #15
0
 function __construct()
 {
     parent::__construct("date");
 }
Exemple #16
0
 public function getStatic()
 {
     return CUtils::cut_text(parent::getStatic());
 }
Exemple #17
0
class FieldType extends Enum
{
    public static $HIDDEN = 0;
    public static $TEXT = 1;
    public static $EMAIL = 2;
    public static $NUMBER = 3;
    public static $TEXTAREA = 4;
    public static $SELECT = 5;
    public static $CHECKBOX = 6;
    public static $RADIOBUTTON = 7;
    public static $MEDIAUPLOAD = 8;
    public static $COLORPICKER = 9;
    public static $COLLECTION = 10;
    public static $ONOFF = 11;
}
FieldType::enumerate();
class FormField
{
    protected $_value;
    protected $_name;
    protected $_id;
    protected $_section_id;
    protected $_option_label;
    protected $_additional_params;
    protected $_validatorFunc;
    protected $_inCustomizer;
    function __construct($option_id, $option_name, $section_id, $option_label = '', $additional_params = array(), $in_customizer = false)
    {
        $this->_id = $option_id;
        $this->_name = $option_name;
        $this->_section_id = $section_id;
 /**
  * Get the value.
  *
  * @return mixed
  */
 public function get()
 {
     $entry = $this->fieldType->getEntry();
     $attributes = $entry->getAttributes();
     return array_get($attributes, $this->fieldType->getColumnName());
 }
Exemple #19
0
 public function __construct(&$props, $dbArray = null)
 {
     parent::__construct($props, $dbArray);
 }
Exemple #20
0
 public function getSearchInput()
 {
     return $this->enum_getInput(parent::getSearchValue(), parent::getSearchName());
 }