Beispiel #1
0
 function create($aData)
 {
     if (!isset($aData['FLD_UID'])) {
         $aData['FLD_UID'] = G::generateUniqueID();
     } else {
         if ($aData['FLD_UID'] == '') {
             $aData['FLD_UID'] = G::generateUniqueID();
         }
     }
     $oConnection = Propel::getConnection(FieldsPeer::DATABASE_NAME);
     try {
         $oFields = new Fields();
         $oFields->fromArray($aData, BasePeer::TYPE_FIELDNAME);
         if ($oFields->validate()) {
             $oConnection->begin();
             $iResult = $oFields->save();
             $oConnection->commit();
             return $aData['FLD_UID'];
         } else {
             $sMessage = '';
             $aValidationFailures = $oFields->getValidationFailures();
             foreach ($aValidationFailures as $oValidationFailure) {
                 $sMessage .= $oValidationFailure->getMessage() . '<br />';
             }
             throw new Exception('The registry cannot be created!<br />' . $sMessage);
         }
     } catch (Exception $oError) {
         $oConnection->rollback();
         throw $oError;
     }
 }
Beispiel #2
0
 public function testSetFields()
 {
     $this->fields->setFields(array('alphaField' => 'foo', 'valueField' => 'bar'));
     $this->assertEquals('foo', $this->fields->getAlphaField());
     $this->assertEquals('bar', $this->fields->getValueField());
     $this->assertNull($this->fields->getColorField());
 }
 /**
  *  displayWebForm
  *  Display the webform within OFuz.net so we can use all the ofuz / radria field type
  */
 function displayWebFormFields()
 {
     $out = '<table>';
     $do_webform_userfields = new WebFormUserField();
     $do_webform_userfields->query("SELECT wfu.name, wfu.label, wfu.required, wfu.size, wff.field_type \n\t\t                                 FROM webformfields as wff, webformuserfield as wfu \n\t\t\t\t\t\t\t\t\t\t WHERE wff.name=wfu.name\n\t\t\t\t\t\t\t\t\t\t   AND wfu.idwebformuser = "******"\n\t\t\t\t\t\t\t\t\t\t ORDER BY wff.display_order");
     $field_format = new Fields();
     while ($do_webform_userfields->next()) {
         $field_format->addField($do_webform_userfields->name, $do_webform_userfields->field_type);
         if ($do_webform_userfields->size) {
             if ($do_webform_userfields->field_type == 'FieldTypeText') {
                 $field_format->fields[$do_webform_userfields->name]->textarea = $do_webform_userfields->size;
             } else {
                 $field_format->fields[$do_webform_userfields->name]->size = $do_webform_userfields->size;
             }
         }
     }
     //print_r($field_format);
     $do_webform_userfields->first();
     //$do_webform_userfields->newForm();
     //$do_webform_userfields->setFields($field_format);
     //$do_webform_userfields->setApplyFieldFormating(true);
     while ($do_webform_userfields->next()) {
         $out .= "\n" . '<tr><td class="webform_row_label">' . $do_webform_userfields->label . '</td><td class="webform_row_field">' . $field_format->applyRegToForm($do_webform_userfields->name, '') . '</td></tr>';
     }
     $out .= '</table>';
     return $out;
 }
 public function test_scenario1()
 {
     $data = array(array('filename' => 'data/iris_missing.csv', 'params' => array("fields" => array("000000" => array("optype" => "numeric"))), 'missing_values' => array("000000" => 1)));
     print "Successfully obtaining missing values counts\n";
     foreach ($data as $item) {
         print "I create a data source uploading a " . $item["filename"] . " file\n";
         $source = self::$api->create_source($item["filename"], $options = array('name' => 'local_test_source'));
         $this->assertEquals(BigMLRequest::HTTP_CREATED, $source->code);
         $this->assertEquals(1, $source->object->status->code);
         print "check local source is ready\n";
         $resource = self::$api->_check_resource($source->resource, null, 20000, 30);
         $this->assertEquals(BigMLRequest::FINISHED, $resource["status"]);
         print "I update the source with params ";
         $source = self::$api->update_source($source->resource, $item["params"]);
         print "create dataset with local source\n";
         $dataset = self::$api->create_dataset($source->resource);
         $this->assertEquals(BigMLRequest::HTTP_CREATED, $dataset->code);
         $this->assertEquals(BigMLRequest::QUEUED, $dataset->object->status->code);
         print "check the dataset is ready " . $dataset->resource . " \n";
         $resource = self::$api->_check_resource($dataset->resource, null, 20000, 30);
         $this->assertEquals(BigMLRequest::FINISHED, $resource["status"]);
         print "When I ask for the missing values counts in the fields\n";
         $fields = new Fields($resource["resource"]->object->fields);
         print "Then the missing values counts dict is " . json_encode($item["missing_values"]) . "\n";
         $this->assertEquals($item["missing_values"], $fields->missing_counts());
     }
 }
 public function renderLink($field, array $htmlOptions = array())
 {
     $fieldName = $field->fieldName;
     $linkId = '';
     $name = '';
     $linkSource = null;
     // TODO: move this code and duplicate code in X2Model::renderModelInput into a helper
     // method. Might be able to use X2Model::getLinkedModel.
     if (class_exists($field->linkType)) {
         if (!empty($this->owner->{$fieldName})) {
             list($name, $linkId) = Fields::nameAndId($this->owner->{$fieldName});
             $linkModel = X2Model::getLinkedModelMock($field->linkType, $name, $linkId, true);
         } else {
             $linkModel = X2Model::model($field->linkType);
         }
         if ($linkModel instanceof X2Model && $linkModel->asa('X2LinkableBehavior') instanceof X2LinkableBehavior) {
             $linkSource = Yii::app()->controller->createAbsoluteUrl($linkModel->autoCompleteSource);
             $linkId = $linkModel->id;
             $oldLinkFieldVal = $this->owner->{$fieldName};
             $this->owner->{$fieldName} = $name;
         }
     }
     $input = CHtml::hiddenField($field->modelName . '[' . $fieldName . '_id]', $linkId, array());
     $input .= CHtml::activeTextField($this->owner, $field->fieldName, array_merge(array('title' => $field->attributeLabel, 'data-x2-link-source' => $linkSource, 'class' => 'x2-mobile-autocomplete', 'autocomplete' => 'off'), $htmlOptions));
     return $input;
 }
 public function validateAttribute($model, $attribute, $params = array())
 {
     list($name, $id) = Fields::nameAndId($model->{$attribute});
     if (!ctype_digit($id)) {
         $model->addError($attribute, Yii::t('app', '{attr} does not refer to any existing record', array('{attr}' => $model->getAttributeLabel($attribute))));
     }
 }
Beispiel #7
0
 public function getTreeById($id, $option = '')
 {
     $sql = 'SELECT * FROM {{tree}} WHERE id=' . $id;
     $item = DB::getRow($sql);
     $item['fields'] = Fields::getFieldsByTree($id, $option);
     return $item;
 }
Beispiel #8
0
 public function __construct()
 {
     if ($_GET['ref']) {
         $sql = 'SELECT iuser FROM {{iusers_options}} WHERE selfcode=\'' . $_GET['ref'] . '\'';
         $iuser = DB::getOne($sql);
         if ($iuser) {
             $_SESSION['referal'] = $iuser;
         }
     }
     $sql = 'SELECT * FROM {{tree}} WHERE parent=410 AND visible=1 ORDER BY num';
     $list = DB::getAll($sql);
     foreach ($list as $item) {
         $fields = Fields::getFieldsByTree($item['id'], 'wide');
         $item['pic'] = $fields['files_gal']['image'][0]['path'];
         $multi = Fields::getMultiFields($item['id']);
         foreach ($multi['color'] as $row) {
             $item['list'][$row] = Funcs::$referenceId['color'][$row]['name'];
         }
         Run::$colors[$item['id']] = $item;
     }
     //print '<pre>';print_r(Run::$colors);die;
     $sql = 'SELECT * FROM {{tree}} WHERE id=1';
     $row = DB::getRow($sql);
     Run::$socTitle = $row['seo_title'];
     Run::$socDescription = $row['seo_description'];
 }
 public function check_data_input($input)
 {
     if ($input === 0) {
         return false;
     }
     return parent::check_data_input($input);
 }
Beispiel #10
0
 public function getValidFieldTypes()
 {
     if (!isset($this->_validFieldTypes)) {
         $this->_validFieldTypes = array_keys(Fields::getFieldTypes());
     }
     return $this->_validFieldTypes;
 }
 public function build_validator()
 {
     if ($this->is_must_input) {
         $validater .= ' required="required" ';
     }
     $validater .= Fields::build_validator();
     return $validater;
 }
Beispiel #12
0
 /**
  * 
  * @param int $ctype
  * @return Fields
  */
 public function &initXFields($ctype = XFIELDS_VACANCY)
 {
     require_once ENGINE_DIR . '/job/classes/Fields.php';
     if (!is_object($this->xfields) || $this->xfields->getType() != $ctype) {
         $this->xfields = new Fields($ctype, $this);
     }
     return $this->xfields;
 }
Beispiel #13
0
 function __construct($fields_xml = "")
 {
     //if (is_object($fields_xml)) {
     //    $this->fields = $fields_xml->fields;
     //$this->
     //} else {
     parent::__construct($fields_xml, null);
     //}
 }
Beispiel #14
0
    public function getList()
    {
        $start = microtime(true);
        $data = array('list' => array(), 'categories' => array());
        $parentIds = array();
        $sql = '
			SELECT DISTINCT {{catalog}}.*, {{tree}}.* FROM {{catalog}}
			INNER JOIN {{tree}} ON {{catalog}}.tree={{tree}}.id
			WHERE {{catalog}}.market=1 AND {{catalog}}.price>0 AND {{tree}}.visible=1 AND available=1
			ORDER BY num
		';
        //print DB::prefix($sql);
        $catalog = DB::getPagi($sql);
        $fields = Fields::getReserveFieldsByModulePath($tab);
        $k = 1;
        $date_b = explode('.', Funcs::$conf['akcia']['date_begin']);
        $date_e = explode('.', Funcs::$conf['akcia']['date_end']);
        $date_b = mktime(0, 0, 0, $date_b[1], $date_b[0], $date_b[2]);
        $date_e = mktime(23, 59, 59, $date_e[1], $date_e[0], $date_e[2]);
        $today = mktime();
        $yes = 0;
        if ($today >= $date_b && $today <= $date_e) {
            $yes = 1;
        }
        foreach ($catalog as $i => $model) {
            $akcia = '0';
            //if ($yes==1)
            //$akcia=$model['akcia'];
            $data['list'][] = array('id' => $model['id'], 'parent' => $model['parent'], 'fields' => Fields::getFieldsByTree($model['tree'], 'wide'), 'name' => Market::clearInfo($model['name']), 'path' => Catalog::getPathToTree($model['tree']), 'available' => $model['available'], 'bid' => $model['bid'], 'akcia' => $akcia, 'cbid' => $model['cbid'], 'typePrefix' => $model['typePrefix'], 'vendor' => Funcs::$referenceId['vendor'][$model['vendor']]['name'], 'yandex_description' => Market::clearInfo($model['yandex_description']), 'price' => $model['price'], 'local_delivery_cost' => $model['price'] < 4000 ? '200' : '0', 'manufacturer_warranty' => $model['manufacturer_warranty']);
            $parentIds[] = $model['parent'];
            $k++;
            //echo $k.' Время выполнения скрипта '.(microtime(true) - $start).'<br />';
        }
        $parentIds = array_unique($parentIds);
        if (count($parentIds) > 0) {
            $sql = '
				SELECT * FROM {{tree}} WHERE id IN (' . implode(',', $parentIds) . ')
			';
            $list = DB::getAll($sql);
            $parentIds = array();
            foreach ($list as $item) {
                $data['categories'][] = array('id' => $item['id'], 'parent' => $item['parent'], 'name' => $item['name']);
                $parentIds[] = $item['parent'];
            }
            if (count($parentIds) > 0) {
                $sql = '
					SELECT * FROM {{tree}} WHERE id IN (' . implode(',', $parentIds) . ')
				';
                $list = DB::getAll($sql);
                foreach ($list as $item) {
                    $data['categories'][] = array('id' => $item['id'], 'name' => $item['name']);
                }
            }
        }
        return $data;
    }
 /**
  * Constructor
  */
 public function __construct($config = array())
 {
     // first we run the perent constructor
     if (parent::__construct($config)) {
         // set if line numbers should be added to comments
         $this->loadLineNr = $this->componentData->debug_linenr ? true : false;
         return true;
     }
     return false;
 }
 public function test_scenario1()
 {
     $data = array(array('filename' => 'data/iris.csv', 'objective_column' => 0, 'objective_id' => '000000'));
     foreach ($data as $item) {
         print "\nSuccessfully creating a Fields object\n";
         print "Given I create a data source uploading a " . $item["filename"] . " file\n";
         $source = self::$api->create_source($item["filename"], $options = array('name' => 'local_test_source', 'project' => self::$project->resource));
         $this->assertEquals(BigMLRequest::HTTP_CREATED, $source->code);
         $this->assertEquals(1, $source->object->status->code);
         print "And I wait until the source is ready\n";
         $resource = self::$api->_check_resource($source->resource, null, 3000, 30);
         $this->assertEquals(BigMLRequest::FINISHED, $resource["status"]);
         $source = self::$api->get_source($source->resource);
         print "And I create a Fields object from the source with objective column " . $item["objective_column"] . "\n";
         $fields = new Fields($source, null, null, null, intval($item["objective_column"]), true);
         print "Then the object id is " . $item["objective_id"] . "\n";
         $this->assertEquals($fields->field_id($fields->objective_field), $item["objective_id"]);
     }
 }
 public function check_data_input($input)
 {
     if ($input == 0) {
         return false;
     }
     return parent::check_data_input($input);
     $this->default = json_decode($this->value, true);
     if ($this->default == false) {
         $this->default = array();
     }
 }
Beispiel #18
0
 public function getOne($id)
 {
     if ($_POST) {
         if (Spage::send($id)) {
             View::$layout = 'empty';
             View::render('site/redirect', array('href' => '/vacancy/', 'text' => 'Заявка принята!\\nМы свяжемся с Вами в ближайшее время'));
         }
     }
     $field = Fields::getFieldsByTree($id, 'wide');
     return $field;
 }
Beispiel #19
0
 protected function queryFields()
 {
     if (!isset(self::$_fields[$this->tableName()])) {
         // only look up fields if they haven't already been looked up
         if (get_class($this) === 'Product' || get_class($this) === 'Quote') {
             self::$_fields[$this->tableName()] = Fields::model()->findAllByAttributes(array('modelName' => get_class($this) . 's'));
         } else {
             self::$_fields[$this->tableName()] = Fields::model()->findAllByAttributes(array('modelName' => get_class($this)));
         }
     }
     //Yii::app()->db->createCommand()->select('*')->from('x2_fields')->where('modelName="'.get_class($this).'"')->queryAll();
 }
Beispiel #20
0
 /**
  * Fields initialization
  * This method set the initial fields descriptio for this DataObjec
  * Each property in the values array will be stored
  * in the model (database).
  * The Fields object let you assign to it FieldType and
  * manipulates the FieldType properties.
  * Field type define how a property value will display in a context of a Form
  * or general Display.
  * 
  * All the base FieldType are describe here:
  * http://radria.sqlfusion.com/documentation/core:registry:creating_new_field_types
  * You can create your own:
  * http://radria.sqlfusion.com/documentation/core:registry:creating_new_field_types
  * Some extra package add fieldtype from Dojo or other jquery frameworks.
  */
 function initFields()
 {
     $invoice_fields = new Fields();
     $invoice_fields->addField(new FieldTypeInt('idinvoice'));
     $invoice_fields->addField(new FieldTypeChar('num'));
     $invoice_fields->addField(new FieldTypeInt('iduser'));
     $invoice_fields->addField(new FieldTypeText('description'));
     $invoice_fields->addField(new FieldTypeFloat('amount'));
     $invoice_fields->addField(new FieldTypeDateSQL('datepaid'));
     $invoice_fields->addField(new FieldTypeDateSQL('datecreated'));
     $invoice_fields->addfield(new FieldTypeListBoxSmall('status'));
     $invoice_fields->idinvoice->hidden = 1;
     $invoice_fields->iduser->hidden = 1;
     $invoice_fields->description->rows = 10;
     $invoice_fields->description->cols = 40;
     $invoice_fields->amount->numberformat = '$:1:.:,:';
     $invoice_fields->status->listvalues = 'New:Sent:Paid';
     $invoice_fields->status->listlabels = 'new:sent:paid';
     $invoice_fields->status->emptydefault = 'no';
     $this->setFields($invoice_fields);
 }
Beispiel #21
0
 public static function getRSS()
 {
     $data = array();
     $id = Tree::getIdTreeByModule('news');
     $sql = 'SELECT * FROM {{tree}} WHERE parent=' . $id . ' AND visible=1 ORDER BY udate DESC LIMIT 0,10';
     $list = DB::getAll($sql);
     foreach ($list as $item) {
         $field = Fields::getFieldsByTree($item['id']);
         $data[] = array('id' => $item['id'], 'name' => trim(strip_tags($item['name'])), 'preview' => strip_tags($field['preview']), 'path' => 'http:://' . $_SERVER['HTTP_HOST'] . '/about/news/' . $item['id'] . '/', 'udate' => date("D, d M Y H:i:s O", strtotime($item['udate'])));
     }
     return array('list' => $data);
 }
Beispiel #22
0
 private function Preview()
 {
     $products_with_variations = isset($this->data["products_with_variations"]) ? $this->data["products_with_variations"] : 'Off';
     $orders_with_fancy = isset($this->data["orders_with_fancy"]) ? $this->data["orders_with_fancy"] : 'Off';
     $filter = array("recordsstatus" => $this->data["recordsstatus"], "recordsauthor" => $this->data["recordsauthor"], "date-from" => $this->data["date-from"], "date-to" => $this->data["date-to"], "datatype" => $this->data["datatype"], "products_with_variations" => $products_with_variations, "orders_with_fancy" => $orders_with_fancy, "order" => "ID" . " ASC", "limit" => 500);
     if (isset($this->data["prod-cats"])) {
         $filter["prod-cats"] = $this->data["prod-cats"];
     }
     $view = new View("views/datatable");
     $view->setArray(array("fields" => Fields::Get($this->data["datatype"]), "data" => $this->core->GetData($filter), "totalfound" => $this->core->totalfound, "datatype" => $this->data["datatype"]));
     echo json_encode(array("success" => true, "datatable" => $view->render(false)));
 }
Beispiel #23
0
 public static function statusList()
 {
     $field = Fields::model()->findByAttributes(array('modelName' => 'Quotes', 'fieldName' => 'status'));
     $dropdown = Dropdowns::model()->findByPk($field->linkType);
     return json_decode($dropdown->options);
     /*
     		return array(
     		    'Draft'=>Yii::t('quotes','Draft'),
     		    'Presented'=>Yii::t('quotes','Presented'),
     		    "Issued"=>Yii::t('quotes','Issued'),
     		    "Won"=>Yii::t('quotes','Won')
     		); */
 }
Beispiel #24
0
 /**
  * Displays a particular model.
  * @param integer $id the ID of the model to be displayed
  */
 public function actionView($id)
 {
     $type = 'quotes';
     $model = $this->getModel($id);
     if (!$this->checkPermissions($model, 'view')) {
         $this->denied();
     }
     $quoteProducts = $model->lineItems;
     // add quote to user's recent item list
     User::addRecentItem('q', $id, Yii::app()->user->getId());
     $contactNameId = Fields::nameAndId($model->associatedContacts);
     $contactId = $contactNameId[1];
     parent::view($model, $type, array('orders' => $quoteProducts, 'contactId' => $contactId));
 }
Beispiel #25
0
    public function getSearch($parent)
    {
        $data = array();
        $sql = '
			SELECT {{tree}}.* FROM {{tree}} INNER JOIN {{search}} ON {{tree}}.id={{search}}.tree 
			WHERE parent=' . $parent . ' AND search LIKE \'%' . $_POST['q'] . '%\' AND visible=1 
			ORDER BY udate DESC
		';
        $list = DB::getAll($sql);
        foreach ($list as $item) {
            $data[] = array('name' => $item['name'], 'path' => Tree::getPathToTree($item['id']), 'udate' => date('d.m.Y', strtotime($item['udate'])), 'fields' => Fields::getFieldsByTree($item['id'], 'wide'));
        }
        return $data;
    }
 public function Add($value_array)
 {
     $this->values = $value_array;
     $this->CheckError();
     require_once ENGINE_DIR . '/car-market/classes/Fields.php';
     $xfields = new Fields($this->base, $this);
     $this->values['xfields'] = $xfields->EncodeFields($this->values);
     $this->Errors = $this->Errors + $xfields->getErrors();
     if ($this->Errors) {
         return false;
     }
     $this->PreparationValues();
     $this->values['add_date'] = $this->values['update_date'] = $this->base->timer->cur_time;
     $this->values['author'] = $this->member['name'];
     $this->values['author_id'] = $this->member['id'];
     $this->values['author_ip'] = $this->member['ip'];
     $id = $this->base->Insert('auto_autos', $this->values);
     if (!empty($this->values['images'])) {
         $this->values['images'] = array_slice($this->values['images'], 0, $this->config['count_photo'][$this->member['group']]);
         if ($this->values['images']) {
             $this->base->SetWhere('id', $this->values['images'], 'IN', 'auto_images');
             $this->base->Update('auto_images', array('auto_id' => $id), array('auto_id' => 0));
             if (!(int) $this->values['main_photo']) {
                 $this->values['main_photo'] = reset($this->values['images']);
             }
             $this->base->Update('auto_autos', array('photo' => $this->values['main_photo'], 'photo_count' => count($this->values['images'])), array('id' => $id));
         }
     }
     if (!empty($_FILES['photo']['name'][0]) && $this->UploadPhoto($id)) {
         $this->base->Update('auto_autos', array('photo' => $this->values['photo'], 'photo_count' => $this->values['photo_count']), array('id' => $id));
     }
     if (!empty($this->values['allow_site'])) {
         $this->IncrementCounter($this->values['mark_id'], $this->values['model_id']);
         Cache::ClearAllCache();
     }
     return $id;
 }
 /**
  * Create Ticket
  * @param type $user_id
  * @param type $subject
  * @param type $body
  * @param type $helptopic
  * @param type $sla
  * @param type $priority
  * @return type string
  */
 public function create_ticket($user_id, $subject, $body, $helptopic, $sla, $priority, $source, $headers, $dept, $assignto, $form_data, $attach = '')
 {
     try {
         $max_number = Tickets::whereRaw('id = (select max(`id`) from tickets)')->first();
         if ($max_number == null) {
             $ticket_number = "AAAA-9999-9999999";
         } else {
             foreach ($max_number as $number) {
                 $ticket_number = $max_number->ticket_number;
             }
         }
         $ticket = new Tickets();
         $ticket->ticket_number = $this->ticket_number($ticket_number);
         $ticket->user_id = $user_id;
         $ticket->dept_id = $dept;
         $ticket->help_topic_id = $helptopic;
         $ticket->sla = $sla;
         $ticket->assigned_to = $assignto;
         $ticket->status = '1';
         $ticket->priority_id = $priority;
         $ticket->source = $source;
         $ticket->save();
         $ticket_number = $ticket->ticket_number;
         $id = $ticket->id;
         if ($form_data != null) {
             $help_topic = Help_topic::where('id', '=', $helptopic)->first();
             $forms = Fields::where('forms_id', '=', $help_topic->custom_form)->get();
             foreach ($form_data as $key => $form_details) {
                 foreach ($forms as $from) {
                     if ($from->name == $key) {
                         $form_value = new Ticket_Form_Data();
                         $form_value->ticket_id = $id;
                         $form_value->title = $from->label;
                         $form_value->content = $form_details;
                         $form_value->save();
                     }
                 }
             }
         }
         $this->store_collaborators($headers, $id);
         $thread = $this->ticket_thread($subject, $body, $id, $user_id);
         if (!empty($attach)) {
             $this->attach($thread, $attach);
         }
         return $thread;
     } catch (\Exception $e) {
         return $e->getMessage();
     }
 }
Beispiel #28
0
 /**
  * Fields initialization
  * This method set the initial fields descriptio for this DataObjec
  * Each property in the values array will be stored
  * in the model (database).
  * The Fields object let you assign to it FieldType and
  * manipulates the FieldType properties.
  * Field type define how a property value will display in a context of a Form
  * or general Display.
  * 
  * All the base FieldType are describe here:
  * http://radria.sqlfusion.com/documentation/core:registry:creating_new_field_types
  * You can create your own:
  * http://radria.sqlfusion.com/documentation/core:registry:creating_new_field_types
  * Some extra package add fieldtype from Dojo or other jquery frameworks.
  */
 function initFields()
 {
     $user_fields = new Fields();
     $user_fields->addField(new FieldTypeChar('firstname'));
     $user_fields->firstname->required = 1;
     $user_fields->firstname->size = 20;
     $user_fields->addField(new FieldTypeChar('lastname'));
     $user_fields->lastname->size = 20;
     $user_fields->addField(new FieldTypeLogin('email'));
     $user_fields->email->textline = '20:30';
     $user_fields->email->required = 1;
     $user_fields->addField(new FieldTypePassword('password'));
     $user_fields->password->size = 10;
     $user_fields->addField(new FieldTypeListBoxSmall('status'));
     $user_fields->status->listvalues = 'Active:Inactive:Suspended:Paid';
     $user_fields->status->listlabels = 'active:inactive:suspend:paid';
     $user_fields->status->emptydefault = 'no';
     $user_fields->addField(new FieldTypeDateSQL('regdate'));
     $user_fields->regdate->hidden = 1;
     $user_fields->addField(new FieldTypeInt('iduser'));
     $user_fields->iduser->hidden = 1;
     $this->setFields($user_fields);
 }
Beispiel #29
0
 function run($data)
 {
     $list = array();
     foreach (Funcs::$referenceId['options'] as $key => $item) {
         if (is_numeric($item['value'])) {
             $list[$item['path']] = $data[$item['path']];
             $list[$item['path']]['act'] = $item['value'];
             $list[$item['path']]['path'] = $item['path'];
         } else {
             $value = explode("\n", $item['value']);
             if (in_array(end(Funcs::$uri), explode(';', $value[2])) && $value[2] != '' || $value[2] == '') {
                 if ($item['path'] == 'select' || $item['path'] == 'checkbox' || $item['path'] == 'radio') {
                     $temp = OptionsWidget::getValuesSelect($item['name']);
                 } elseif ($item['path'] == 'number') {
                     $temp = OptionsWidget::getValuesNumber($item['name']);
                 } elseif ($item['path'] == 'link') {
                     $temp = OptionsWidget::getValuesLink($value);
                 }
                 if (count($temp) > 0) {
                     $list[$item['value']]['list'] = $temp;
                     $list[$item['value']]['name'] = trim($value[0]);
                     $list[$item['value']]['path'] = $item['path'];
                     $list[$item['value']]['title'] = trim($value[1]) == '' ? $item['name'] : $value[1];
                 }
             }
         }
     }
     $tree = Tree::getTreeByUrl();
     foreach (Fields::getFeaturesList($tree['id']) as $items) {
         foreach ($items['list'] as $item) {
             if ($item['filtertype'] == 'checkbox' || $item['filtertype'] == 'checkboxgroup' || $item['filtertype'] == 'select') {
                 $temp = OptionsWidget::getValuesSelect($item['path']);
             } elseif ($item['filtertype'] == 'number') {
                 $temp = OptionsWidget::getValuesNumber($item['path']);
             }
             $list[$item['path']]['list'] = $temp;
             $list[$item['path']]['name'] = $item['path'];
             $list[$item['path']]['path'] = $item['filtertype'];
             $list[$item['path']]['title'] = $item['name'];
             $list[$item['path']]['comment'] = $item['comment'];
         }
     }
     View::widget('options', array('list' => $list));
 }
Beispiel #30
0
    public function getResult()
    {
        $data = array();
        $q = trim(strip_tags($_GET['q']));
        if ($q) {
            $sql = '
				SELECT * FROM {{search}}
				INNER JOIN {{tree}} ON  {{search}}.tree={{tree}}.id
				WHERE search LIKE \'%' . $q . '%\' AND visible=1
				ORDER BY {{search}}.cdate DESC
			';
            $list = DB::getAll($sql);
            foreach ($list as $item) {
                $fields = Fields::getFieldsByTree($item['tree'], 'gal');
                $path = Tree::getPathToTree($item['tree']);
                $data[] = array('id' => $item['tree'], 'name' => $item['name'], 'path' => $path, 'fields' => $fields, 'info' => Tree::getInfo($item['tree']));
            }
        }
        return $data;
    }