当前位置: 首页>>代码示例>>PHP>>正文


PHP field::add方法代码示例

本文整理汇总了PHP中field::add方法的典型用法代码示例。如果您正苦于以下问题:PHP field::add方法的具体用法?PHP field::add怎么用?PHP field::add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在field的用法示例。


在下文中一共展示了field::add方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: add

 public function add($param = "")
 {
     global $myAdmin;
     global $formMaj;
     global $datas_lang;
     global $smarty;
     global $thisSite;
     $this->LANG_DATAS = $myAdmin->LANG_DATAS;
     parent::add();
     $smarty->assign('this', $this);
     $smarty->assign('param', $param);
     $smarty->assign('language', $thisSite->LIST_LANG_COMP[$myAdmin->LANG_INTERFACE]);
     $toolbars = array();
     $toolbars["Default"][1] = "cut copy paste pastetext | undo redo | bold italic underline strikethrough | subscript superscript | removeformat | charmap emoticons hr nonbreaking";
     $toolbars["Default"][2] = "bullist numlist | outdent indent | alignleft aligncenter alignright alignjustify | image | inserttable tableprops deletetable cell row column | link unlink | anchor  | template  | visualblocks | code";
     $toolbars["Default"][3] = "styleselect  fontselect fontsizeselect | forecolor backcolor";
     $toolbars["Basic"][1] = "bold italic underline strikethrough | subscript superscript | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent";
     $toolbars["Basic"][2] = "styleselect | link unlink | image charmap | code";
     $toolbars["Simple"][1] = "bold italic underline strikethrough | alignleft aligncenter alignright alignjustify | bullist numlist | link unlink | image charmap | code";
     $toolbars["Image"][1] = "image | code";
     $smarty->assign('toolbar', $toolbars[$this->toolbar]);
     $data = $smarty->fetch($this->pathTemplate . 'inc/fields/class.editortm.tpl');
     addStructure("addJsStructure", DOS_OUTILS_ADMIN . "tinymceJQ/jquery.tinymce.min.js");
     addStructure("addJsStructure", DOS_OUTILS_ADMIN . "tinymceJQ/tinymce.min.js");
     $this->smartAssign($this->field, $data);
     return $data;
 }
开发者ID:wedesign-pf,项目名称:Tit,代码行数:27,代码来源:class.editortm.php

示例2: add

 public function add($param = "")
 {
     global $formMaj;
     global $datas_lang;
     global $smarty;
     global $thisSite;
     parent::add();
     $smarty->assign('this', $this);
     $rangeLg = array();
     foreach ($this->list_lang as $clg => $extlg) {
         $value = $this->getValue($clg);
         $values = explode(",", $value);
         if (count($values) == 2) {
             $range = 1;
         } else {
             if (count($values) == 1) {
                 $range = 0;
             } else {
                 return false;
             }
         }
         $rangeLg[$clg] = $range;
     }
     $smarty->assign('rangeLg', $rangeLg);
     $data = $smarty->fetch($this->pathTemplate . 'inc/fields/class.slider.tpl');
     $this->smartAssign($this->field, $data);
     return $data;
 }
开发者ID:wedesign-pf,项目名称:Tit,代码行数:28,代码来源:class.slider.php

示例3: add

 public function add($param = "")
 {
     global $formMaj;
     global $datas_lang;
     global $smarty;
     global $thisSite;
     parent::add();
     $smarty->assign('this', $this);
     $data = $smarty->fetch($this->pathTemplate . 'inc/fields/class.file.tpl');
     $this->smartAssign($this->field, $data);
     return $data;
 }
开发者ID:wedesign-pf,项目名称:code-g,代码行数:12,代码来源:class.file.php

示例4: add

 public function add($param = "")
 {
     global $myAdmin;
     global $formMaj;
     global $datas_lang;
     global $smarty;
     global $thisSite;
     parent::add();
     $smarty->assign('this', $this);
     $smarty->assign('param', $param);
     $data = $smarty->fetch($this->pathTemplate . 'inc/fields/class.editorck.tpl');
     addStructure("addJsStructure", DOS_OUTILS_ADMIN . "ckeditor/ckeditor.js");
     addStructure("addJsStructure", DOS_OUTILS_ADMIN . "ckeditor/adapters/jquery.js");
     $this->smartAssign($this->field, $data);
     return $data;
 }
开发者ID:wedesign-pf,项目名称:Tit,代码行数:16,代码来源:class.editorck.php

示例5: add

 public function add($param = "")
 {
     global $formMaj;
     global $datas_lang;
     global $smarty;
     global $thisSite;
     parent::add();
     $smarty->assign('this', $this);
     $liste = array();
     for ($indice = $this->max; $indice >= 1; $indice--) {
         //for ($indice = 1; $indice <= $this->max; $indice++) {
         $liste[] = $indice;
     }
     $smarty->assign('liste', $liste);
     $data = $smarty->fetch($this->pathTemplate . 'inc/fields/class.rating.tpl');
     $this->smartAssign($this->field, $data);
     return $data;
 }
开发者ID:wedesign-pf,项目名称:Tit,代码行数:18,代码来源:class.rating.php

示例6: add

 public function add($param = "")
 {
     global $formMaj;
     global $datas_lang;
     global $smarty;
     global $thisSite;
     parent::add();
     $smarty->assign('this', $this);
     $src_valueLg = array();
     foreach ($this->list_lang as $clg => $extlg) {
         $value = $this->getValue($clg);
         $src_value = format_date($value, ".");
         $src_valueLg[$clg] = $src_value;
     }
     $smarty->assign('src_valueLg', $src_valueLg);
     $data = $smarty->fetch($this->pathTemplate . 'inc/fields/class.date.tpl');
     $this->smartAssign($this->field, $data);
     return $data;
 }
开发者ID:wedesign-pf,项目名称:Tit,代码行数:19,代码来源:class.date.php

示例7: add

 public function add($param = "")
 {
     global $myAdmin;
     global $formMaj;
     global $datas_lang;
     global $smarty;
     global $thisSite;
     parent::add();
     if ($this->insideForm == false) {
         $this->fileRequired = true;
         $this->legendeEnabled = true;
     }
     if ($this->insideForm == true) {
         $prefixe_field = $this->field . "__";
         $mySelect = new mySelect(__FILE__);
         $mySelect->tables = $thisSite->PREFIXE_TBL_GEN . "medias";
         $mySelect->fields = "*";
         $mySelect->orderby = "id DESC";
         // pour prendre le premier élément
         $mySelect->where = "field_media=:field_media AND id_parent=:id_parent";
         $mySelect->whereValue["field_media"] = array($this->field, PDO::PARAM_STR);
         //$formMaj->tables . "." .
         $id_parent = $formMaj->datasForm[$myAdmin->LANG_DATAS]["id"];
         if ($id_parent == "") {
             $id_parent = $formMaj->datasForm[""]["id"];
         }
         $mySelect->whereValue["id_parent"] = array($id_parent, PDO::PARAM_INT);
         $resultmySelect = $mySelect->query();
         foreach ($resultmySelect as $rowS) {
             $lg = $rowS["lg"];
             $value_fichier_media[$lg] = $rowS["fichier_media"];
             $value_titre_media[$lg] = $rowS["titre_media"];
             if ($lg == $myAdmin->LANG_DEF) {
                 // pour les données monolangue
                 $value_idMedia = $rowS["id"];
                 $value_fichier_media[""] = $rowS["fichier_media"];
                 $value_titre_media[""] = $rowS["titre_media"];
             }
         }
     } else {
         $prefixe_field = "";
     }
     $newfield = new file();
     $newfield->field = $prefixe_field . "fichier_media";
     $newfield->multiLang = $this->multiLangType;
     if ($this->insideForm == true) {
         $newfield->label = $this->label;
     } else {
         $newfield->label = $datas_lang["fichier_media"];
     }
     $newfield->value = $value_fichier_media;
     $newfield->startFolder = $this->startFolder;
     $newfield->tooltip = $this->tooltip;
     $newfield->addClass = $this->addClass;
     $newfield->extensionsAuthorized = "";
     if ($this->extensionsAuthorized != "") {
         $newfield->extensionsAuthorized = $this->extensionsAuthorized;
     }
     $newfield->multi = $this->multi;
     $newfield->upload = $this->upload;
     $newfield->uploadDirect = $this->uploadDirect;
     $newfield->widthLabel = 2;
     $newfield->widthField = 9;
     $newfield->placeholder = $this->placeholder;
     $result = $newfield->add();
     $field_fichier_media = $result;
     if ($this->fileRequired == true) {
         $newfield->rule("required", true);
     }
     // champ Titre: légende de l'image, du fichier ou du lien
     if ($this->legendeEnabled == true) {
         $newfield = new input();
         $newfield->field = $prefixe_field . "titre_media";
         $newfield->multiLang = true;
         $newfield->value = $value_titre_media;
         $newfield->label = $datas_lang["legende"];
         $newfield->tooltip = $datas_lang["tooltipsLegende"];
         $newfield->widthLabel = 2;
         $newfield->widthField = 9;
         $result = $newfield->add();
         $field_titre_media = $result;
     }
     $smarty->assign('field_fichier_media', $field_fichier_media);
     $smarty->assign('field_titre_media', $field_titre_media);
     if ($this->insideForm == true) {
         $newfield = new hidden();
         $newfield->field = "fieldMedia__" . $this->field;
         $newfield->multiLang = false;
         $newfield->value = serialize(array("type" => $this->type, "field_media" => $this->field, "idMedia" => $value_idMedia));
         $result = $newfield->add();
         $smarty->assign('fieldMediaField', $result);
     }
     $smarty->assign('this', $this);
     $data = $smarty->fetch($this->pathTemplate . 'inc/fields/class.mediaFile.tpl');
     if ($this->insideForm == true) {
         $this->smartAssign($this->field, $data);
     } else {
         $this->smartAssign("media", $data);
     }
     return $data;
//.........这里部分代码省略.........
开发者ID:wedesign-pf,项目名称:Tit,代码行数:101,代码来源:class.mediaFile.php

示例8: add

 public function add($param = "")
 {
     if (!is_array($this->items) && $this->tags != true) {
         return 0;
     }
     global $myAdmin;
     global $formMaj;
     global $datas_lang;
     global $smarty;
     global $thisSite;
     if ($this->tags == true) {
         $this->multiLang = false;
         // multilangue géré par la table des tags
     }
     $this->LIST_LANG_EXTENSION_FIELD = $myAdmin->LIST_LANG_EXTENSION_FIELD;
     parent::add();
     $smarty->assign('this', $this);
     $listDisabled = array();
     if (!is_array($this->valuesDisabled)) {
         $valuesDisabled = explode(",", $this->valuesDisabled);
         $listDisabled = $valuesDisabled;
     } else {
         $listDisabled = $this->valuesDisabled;
     }
     foreach ($this->list_lang as $clg => $extlg) {
         $value = $this->getValue($clg);
         $values = explode(",", $value);
         if (!is_array($values)) {
             $values = array();
         }
         if ($this->tags == true) {
             if ($listItems == "") {
                 $listItems = array();
                 $mySelect2 = new mySelect(__FILE__);
                 $mySelect2->tables = $thisSite->PREFIXE_TBL_GEN . "tags";
                 $mySelect2->fields = "*";
                 $mySelect2->where = "parent=:parent AND lg=:lg";
                 $mySelect2->whereValue["parent"] = array($this->field, PDO::PARAM_STR);
                 $mySelect2->whereValue["lg"] = array("fr", PDO::PARAM_STR);
                 $mySelect2->orderby = "titre ASC";
                 $result2 = $mySelect2->query();
                 foreach ($result2 as $row2) {
                     $listItems[$row2['id']] = $row2['titre'];
                 }
             }
         } else {
             $listItems = $this->items;
         }
         if ($this->iconeLangue() == true || $this->tags == true) {
             $smarty->assign('marginLeft', 50);
         } else {
             $smarty->assign('marginLeft', 0);
         }
         $indice = 0;
         $datasItem = array();
         $count_items = count($listItems);
         $myGroup = "";
         foreach ($listItems as $val => $text) {
             $val = delQuotes($val);
             $value = delQuotes($value);
             if (in_array($val, $listDisabled)) {
                 $stateDisabled = "state-disabled";
                 $disabled = "disabled";
             } else {
                 $stateDisabled = "";
                 $disabled = "";
             }
             if (in_array(htmlspecialchars($val, ENT_QUOTES), $values)) {
                 $selected = "selected";
             } else {
                 $selected = "";
             }
             if ($count_items == 1) {
                 $str_indice = "";
             } else {
                 $str_indice = "_" . $indice;
             }
             $idField = $this->field . $extlg . $str_indice;
             $datasItem[$indice] = array("val" => $val, "text" => $text, "idField" => $idField, "stateDisabled" => $stateDisabled, "disabled" => $disabled, "selected" => $selected);
             $myGroup = $idField;
             $indice++;
             $marginLeft = 0;
         }
         //echoa($datasItem);
         $datasItemByLg[$clg] = $datasItem;
     }
     // lg
     $smarty->assign('datasItemByLg', $datasItemByLg);
     $allmyGroup = $smarty->getTemplateVars("myGroup");
     $allmyGroup .= $this->field . $extlg . ":\"" . $myGroup . "\",\n";
     $smarty->assign("myGroup", $allmyGroup);
     $data = $smarty->fetch($this->pathTemplate . 'inc/fields/class.selectM.tpl');
     addStructure("addJsStructure", DOS_OUTILS_ADMIN . "multiple-select/jquery.multiple.select.js");
     $this->smartAssign($this->field, $data);
     return $data;
 }
开发者ID:wedesign-pf,项目名称:Tit,代码行数:96,代码来源:class.selectM.php

示例9: add

 public function add($param = "")
 {
     if (!is_array($this->items)) {
         return 0;
     }
     global $formMaj;
     global $datas_lang;
     global $smarty;
     global $thisSite;
     parent::add();
     $smarty->assign('this', $this);
     $smarty->assign('classPlus', "inline-group");
     $listDisabled = array();
     if (!is_array($this->valuesDisabled)) {
         $valuesDisabled = explode(",", $this->valuesDisabled);
         $listDisabled = $valuesDisabled;
     } else {
         $listDisabled = $this->valuesDisabled;
     }
     $listItemsByLg = array();
     foreach ($this->list_lang as $clg => $extlg) {
         $value = $this->getValue($clg);
         $listItems = array();
         if (isset($this->noneItem)) {
             if ($this->noneItem === true) {
                 $listItems["noneItem"] = $datas_lang["noneItem"];
             } else {
                 $listItems["noneItem"] = $this->noneItem;
             }
         }
         if (isset($this->allItems)) {
             if ($this->allItems === true) {
                 $listItems["allItems"] = $datas_lang["allItems"];
             } else {
                 $listItems["allItems"] = $this->allItems;
             }
         }
         $listItems += $this->items;
         if ($this->iconeLangue() == true) {
             $marginLeft = 50;
         } else {
             $marginLeft = 0;
         }
         $indice = 0;
         $datasItem = array();
         foreach ($listItems as $val => $text) {
             $val = delQuotes($val);
             $value = delQuotes($value);
             if (in_array($val, $listDisabled)) {
                 $stateDisabled = "state-disabled";
                 $disabled = "disabled";
             } else {
                 $stateDisabled = "";
                 $disabled = "";
             }
             if (htmlspecialchars($val, ENT_QUOTES) == $value) {
                 $checked = "checked";
             } else {
                 $checked = "";
             }
             $idField = $this->field . $extlg . "_" . $indice;
             $datasItem[$indice] = array("val" => $val, "text" => $text, "idField" => $idField, "stateDisabled" => $stateDisabled, "disabled" => $disabled, "checked" => $checked, "marginLeft" => $marginLeft);
             $indice++;
             $marginLeft = 0;
         }
         //echoa($datasItem);
         $datasItemByLg[$clg] = $datasItem;
     }
     // lg
     $smarty->assign('datasItemByLg', $datasItemByLg);
     $data = $smarty->fetch($this->pathTemplate . 'inc/fields/class.radio.tpl');
     $this->smartAssign($this->field, $data);
     return $data;
 }
开发者ID:wedesign-pf,项目名称:Tit,代码行数:74,代码来源:class.radio.php

示例10: customfieldpage

 function action_editfield()
 {
     global $CURMAN;
     $level = $this->required_param('level', PARAM_ACTION);
     $ctxlvl = context_level_base::get_custom_context_level($level, 'block_curr_admin');
     if (!$ctxlvl) {
         print_error('invalid_context_level', 'block_curr_admin');
     }
     $id = $this->optional_param('id', NULL, PARAM_INT);
     require_once CURMAN_DIRLOCATION . '/form/customfieldform.class.php';
     $tmppage = new customfieldpage(array('level' => $level, 'action' => 'editfield'), $this);
     $form = new customfieldform($tmppage->get_moodle_url(), $this);
     if ($form->is_cancelled()) {
         $tmppage = new customfieldpage(array('level' => $level));
         redirect($tmppage->get_url(), get_string('edit_cancelled', 'block_curr_admin'));
     } else {
         if ($data = $form->get_data()) {
             $field = new field($data);
             if ($id) {
                 $field->id = $id;
                 $field->update();
             } else {
                 $field->add();
                 // assume each field only belongs to one context level (for now)
                 $fieldcontext = new field_contextlevel();
                 $fieldcontext->fieldid = $field->id;
                 $fieldcontext->contextlevel = $ctxlvl;
                 $fieldcontext->add();
             }
             //don't use !empty here because we might be storing a 0 or similar value
             if ($data->defaultdata != '') {
                 // save the default value
                 $defaultdata = $data->defaultdata;
                 if ($field->multivalued) {
                     // parse as a CSV string
                     // until we can use str_getcsv from PHP 5.3...
                     $temp = fopen("php://memory", "rw");
                     fwrite($temp, $defaultdata);
                     rewind($temp);
                     $defaultdata = fgetcsv($temp);
                     fclose($temp);
                 }
                 field_data::set_for_context_and_field(NULL, $field, $defaultdata);
             } else {
                 if ($field->multivalued) {
                     field_data::set_for_context_and_field(NULL, $field, array());
                 } else {
                     field_data::set_for_context_and_field(NULL, $field, NULL);
                 }
             }
             $plugins = get_list_of_plugins('curriculum/plugins');
             foreach ($plugins as $plugin) {
                 if (is_readable(CURMAN_DIRLOCATION . '/plugins/' . $plugin . '/custom_fields.php')) {
                     include_once CURMAN_DIRLOCATION . '/plugins/' . $plugin . '/custom_fields.php';
                     if (function_exists("{$plugin}_field_save_form_data")) {
                         call_user_func("{$plugin}_field_save_form_data", $form, $field, $data);
                     }
                 }
             }
             $tmppage = new customfieldpage(array('level' => $level));
             redirect($tmppage->get_url(), get_string('field_saved', 'block_curr_admin', $field));
         } else {
             if (!empty($id)) {
                 if ($this->optional_param('from', NULL, PARAM_CLEAN) == 'moodle' && $level == 'user') {
                     $moodlefield = $CURMAN->db->get_record('user_info_field', 'id', $id);
                     if (!$moodlefield) {
                         print_error('invalidfieldid', 'block_curr_admin');
                     }
                     unset($moodlefield->id);
                     $data_array = (array) $moodlefield;
                     $data_array['datatype'] = 'text';
                     $data_array['manual_field_control'] = $moodlefield->datatype;
                     switch ($moodlefield->datatype) {
                         case field::checkbox:
                             $data_array['datatype'] = 'bool';
                             break;
                         case field::menu:
                             $data_array['datatype'] = 'char';
                             $data_array['manual_field_options'] = $moodlefield->param1;
                             break;
                         case field::textarea:
                             $data_array['manual_field_columns'] = $moodlefield->param1;
                             $data_array['manual_field_rows'] = $moodlefield->param2;
                             break;
                         case field::text:
                             if ($moodlefield->param3) {
                                 $data_array['manual_field_control'] = 'password';
                             }
                             $data_array['manual_field_columns'] = $moodlefield->param1;
                             $data_array['manual_field_maxlength'] = $moodlefield->param2;
                             break;
                     }
                 } else {
                     $data = new field($id);
                     $data_array = $data->to_array();
                     $defaultdata = field_data::get_for_context_and_field(NULL, $data);
                     if (!empty($defaultdata)) {
                         if ($data->multivalued) {
                             $values = array();
                             // extract the data
//.........这里部分代码省略.........
开发者ID:remotelearner,项目名称:elis.cm,代码行数:101,代码来源:customfieldpage.class.php


注:本文中的field::add方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。