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


PHP FabrikString::getShortDdLabel方法代码示例

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


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

示例1: _formatOptions

 /**
  * Format options
  *
  * @param array $res
  * @param       $valueFormat
  *
  * @return array
  * @throws Exception
  */
 private function _formatOptions(array $res, $valueFormat)
 {
     $aEls = array();
     $input = JFactory::getApplication()->input;
     $controller = $input->get('view', $input->get('task'));
     if ($controller == 'element') {
         foreach ($res as $o) {
             $s = new stdClass();
             // Element already contains correct key
             if ($controller != 'element') {
                 $s->value = $valueFormat == 'tableelement' ? $o->table_name . '.' . $o->text : $o->value;
             } else {
                 $s->value = $o->value;
             }
             $s->text = FabrikString::getShortDdLabel($o->text);
             $aEls[] = $s;
         }
     } else {
         foreach ($res as &$o) {
             $o->text = FabrikString::getShortDdLabel($o->text);
         }
         $aEls = $res;
     }
     // Paul - Prepend rather than append "none" option.
     array_unshift($aEls, JHTML::_('select.option', '', '-'));
     return $aEls;
 }
开发者ID:glauberm,项目名称:cinevi,代码行数:36,代码来源:listfields.php

示例2: getElements

 public function getElements()
 {
     $db = FabrikWorker::getDbo(true);
     $item = $this->getItem();
     $aEls = array();
     $aGroups = array();
     $query = $db->getQuery(true);
     $query->select('form_id');
     $query->from($db->nameQuote('#__{package}_formgroup') . ' AS fg');
     $query->where('fg.group_id = ' . (int) $item->group_id);
     $db->setQuery($query);
     $formrow = $db->loadObject();
     if (is_null($formrow)) {
         $aEls[] = $aGroups[] = JText::_('COM_FABRIK_GROUP_MUST_BE_IN_A_FORM');
     } else {
         $formModel = JModel::getInstance('Form', 'FabrikFEModel');
         $formModel->setId($formrow->form_id);
         //get available element types
         $groups = $formModel->getGroupsHiarachy();
         foreach ($groups as $groupModel) {
             $group = $groupModel->getGroup();
             $o = new stdClass();
             $o->label = $group->name;
             $o->value = "fabrik_trigger_group_group" . $group->id;
             $aGroups[] = $o;
             $elementModels =& $groupModel->getMyElements();
             foreach ($elementModels as $elementModel) {
                 $o = new stdClass();
                 $element =& $elementModel->getElement();
                 $o->label = FabrikString::getShortDdLabel($element->label);
                 $o->value = "fabrik_trigger_element_" . $elementModel->getFullName(false, true, false);
                 $aEls[] = $o;
             }
         }
     }
     asort($aEls);
     $o = new StdClass();
     $o->groups = $aGroups;
     $o->elements = array_values($aEls);
     return $o;
 }
开发者ID:rhotog,项目名称:fabrik,代码行数:41,代码来源:element.php

示例3: edit

 /**
  * Edit an element
  */
 function edit()
 {
     global $_PROFILER;
     JDEBUG ? $_PROFILER->mark('edit: start') : null;
     $app =& JFactory::getApplication();
     $user =& JFactory::getUser();
     $db =& JFactory::getDBO();
     $acl =& JFactory::getACL();
     $model =& JModel::getInstance('element', 'FabrikModel');
     if ($this->_task == 'edit') {
         $cid = JRequest::getVar('cid', array(0), 'method', 'array');
         $cid = array((int) $cid[0]);
     } else {
         $cid = array(0);
     }
     $model->setId($cid[0]);
     $row =& $model->getElement();
     if ($cid) {
         $row->checkout($user->get('id'));
     }
     // get params definitions
     $params =& $model->getParams();
     require_once JPATH_COMPONENT . DS . 'views' . DS . 'element.php';
     $pluginManager =& JModel::getInstance('Pluginmanager', 'FabrikModel');
     $db->setQuery("SELECT COUNT(*) FROM #__fabrik_groups");
     $total = $db->loadResult();
     if ($total == 0) {
         $app->redirect("index.php?option=com_fabrik&c=group&task=new", JText::_('PLEASE CREATE A GROUP BEFORE CREATING AN ELEMENT'));
         return;
     }
     $lists = array();
     if ($cid[0] != '0') {
         $aEls = array();
         $aGroups = array();
         $db->setQuery("SELECT form_id FROM #__fabrik_formgroup AS fg\n" . "WHERE fg.group_id = {$row->group_id}");
         $formrow = $db->loadObject();
         if (is_null($formrow)) {
             $aEls[] = $aGroups[] = JText::_('GROUP MUST BE IN A FORM');
         } else {
             $formModel = JModel::getInstance('form', 'FabrikModel');
             $formModel->setId($formrow->form_id);
             //get available element types
             $groups =& $formModel->getGroupsHiarachy();
             foreach ($groups as $groupModel) {
                 $group =& $groupModel->getGroup();
                 $o = new stdClass();
                 $o->label = $group->name;
                 $o->value = "fabrik_trigger_group_group" . $group->id;
                 $aGroups[] = $o;
                 $elementModels =& $groupModel->getMyElements();
                 foreach ($elementModels as $elementModel) {
                     $o = new stdClass();
                     $element =& $elementModel->getElement();
                     $o->label = FabrikString::getShortDdLabel($element->label);
                     $o->value = "fabrik_trigger_element_" . $elementModel->getFullName(false, true, false);
                     $aEls[] = $o;
                 }
             }
         }
         asort($aEls);
         $o = new StdClass();
         $o->groups = $aGroups;
         $o->elements = array_values($aEls);
         $lists['elements'] = $o;
     } else {
         // set the publish default to 1
         $row->state = '1';
         $lists['elements'] = array(JText::_('AVAILABLE ONCE SAVED'));
     }
     JDEBUG ? $_PROFILER->mark('edit: after element types') : null;
     $pluginManager->getPlugInGroup('validationrule');
     $pluginManager->loadPlugInGroup('element');
     $j = new JRegistry();
     $lists['jsActions'] = $model->getJSActions();
     //merge the js attribs back into the array
     foreach ($lists['jsActions'] as $js) {
         $j->loadINI($js->attribs);
         $a = $j->toArray();
         foreach ($a as $k => $v) {
             $js->{$k} = $v;
         }
         unset($js->attribs);
     }
     $no_html = JRequest::getBool('no_html', 0);
     // Create the form
     $form = new fabrikParams('', JPATH_COMPONENT . DS . 'models' . DS . 'element.xml');
     $form->bind($row);
     $form->loadINI($row->attribs);
     $row->parent_id = (int) $row->parent_id;
     if ($row->parent_id === 0) {
         $lists['parent'] = 0;
     } else {
         $sql = "SELECT * FROM #__fabrik_elements WHERE id = " . (int) $row->parent_id;
         $db->setQuery($sql);
         $parent = $db->loadObject();
         if (is_null($parent)) {
             //perhaps the parent element was deleted?
//.........这里部分代码省略.........
开发者ID:nikshade,项目名称:fabrik21,代码行数:101,代码来源:element.php

示例4: ajax_fields

 /**
  * Get a list of fields
  *
  * @return  string  json encoded list of fields
  */
 public function ajax_fields()
 {
     $app = JFactory::getApplication();
     $input = $app->input;
     $tid = $input->get('t');
     $keyType = $input->getInt('k', 1);
     // If true show all fields if false show fabrik elements
     $showAll = $input->getBool('showall', false);
     // Should we highlight the PK as a recommended option
     $highlightpk = $input->getBool('highlightpk');
     // Only used if showall = false, includes validations as separate entries
     $incCalculations = $input->get('calcs', false);
     $arr = array();
     try {
         if ($showAll) {
             // Show all db columns
             $cid = $input->get('cid', -1);
             $cnn = JModelLegacy::getInstance('Connection', 'FabrikFEModel');
             $cnn->setId($cid);
             $db = $cnn->getDb();
             if ($tid != '') {
                 if (is_numeric($tid)) {
                     // If loading on a numeric list id get the list db table name
                     $jDb = FabrikWorker::getDbo(true);
                     $query = $jDb->getQuery(true);
                     $query->select('db_table_name')->from('#__{package}_lists')->where('id = ' . (int) $tid);
                     $jDb->setQuery($query);
                     $tid = $jDb->loadResult();
                 }
                 $db->setQuery('DESCRIBE ' . $db->quoteName($tid));
                 $rows = $db->loadObjectList();
                 if (is_array($rows)) {
                     foreach ($rows as $r) {
                         $c = new stdClass();
                         $c->value = $r->Field;
                         $c->label = $r->Field;
                         if ($highlightpk && $r->Key === 'PRI') {
                             $c->label .= ' [' . JText::_('COM_FABRIK_RECOMMENDED') . ']';
                             array_unshift($arr, $c);
                         } else {
                             $arr[$r->Field] = $c;
                         }
                     }
                     ksort($arr);
                     $arr = array_values($arr);
                 }
             }
         } else {
             /*
              * show fabrik elements in the table
              * $keyType 1 = $element->id;
              * $keyType 2 = tablename___elementname
              */
             $model = JModelLegacy::getInstance('List', 'FabrikFEModel');
             $model->setId($tid);
             $table = $model->getTable();
             $db = $model->getDb();
             $groups = $model->getFormGroupElementData();
             $published = $input->get('published', false);
             $showintable = $input->get('showintable', false);
             foreach ($groups as $g => $groupModel) {
                 if ($groupModel->isJoin()) {
                     if ($input->get('excludejoined') == 1) {
                         continue;
                     }
                     $joinModel = $groupModel->getJoinModel();
                     $join = $joinModel->getJoin();
                 }
                 if ($published == true) {
                     $elementModels = $groups[$g]->getPublishedElements();
                 } else {
                     $elementModels = $groups[$g]->getMyElements();
                 }
                 foreach ($elementModels as $e => $eVal) {
                     $element = $eVal->getElement();
                     if ($showintable == true && $element->show_in_list_summary == 0) {
                         continue;
                     }
                     if ($keyType == 1) {
                         $v = $element->id;
                     } else {
                         /*
                          * @TODO if in repeat group this is going to add [] to name - is this really
                          * what we want? In timeline viz options I've simply stripped out the [] off the end
                          * as a temp hack
                          */
                         $useStep = $keyType === 2 ? true : false;
                         $v = $eVal->getFullName($useStep);
                     }
                     $c = new stdClass();
                     $c->value = $v;
                     $label = FabrikString::getShortDdLabel($element->label);
                     if ($groupModel->isJoin()) {
                         $label = $join->table_join . '.' . $label;
                     }
//.........这里部分代码省略.........
开发者ID:ppantilla,项目名称:bbninja,代码行数:101,代码来源:plugin.php

示例5: getInput


//.........这里部分代码省略.........
                 $groupModel->setId($groupId);
                 $optskey = $valueformat == 'tableelement' ? 'name' : 'id';
                 $res = $groupModel->getForm()->getElementOptions(false, $optskey, $onlylistfields, false, $pluginFilters);
                 $hash = "{$controller}." . implode('.', $bits);
                 if (array_key_exists($hash, $this->results)) {
                     $res = $this->results[$hash];
                 } else {
                     $this->results[$hash] =& $res;
                 }
             } else {
                 //****************************//
                 $repeat = ElementHelper::getRepeat($this);
                 $tableDd = $this->element['table'];
                 $opts = new stdClass();
                 $opts->table = $repeat ? 'jform_' . $tableDd . "-" . $c : 'jform_' . $tableDd;
                 $opts->conn = 'jform_' . $connectionDd;
                 $opts->value = $this->value;
                 $opts->repeat = $this->value;
                 $opts = json_encode($opts);
                 $script = "new ListFieldsElement('{$this->id}', {$opts});\n";
                 FabrikHelperHTML::script('administrator/components/com_fabrik/models/fields/listfields.js', $script);
                 $rows = array(JHTML::_('select.option', '', JText::_('SELECT A CONNECTION FIRST')), 'value', 'text');
                 $o = new stdClass();
                 $o->table_name = '';
                 $o->name = '';
                 $o->value = '';
                 $o->text = JText::_('COM_FABRIK_SELECT_A_TABLE_FIRST');
                 $res[] = $o;
                 //****************************//
             }
             break;
         case 'listform':
         case 'list':
         case 'module':
         case 'item':
             //menu item
             if ($controller === 'item') {
                 $id = $this->form->getValue('request.listid');
             } else {
                 $id = $this->form->getValue('id');
             }
             if (!isset($this->form->model)) {
                 echo "not set ";
                 if (!in_array($controller, array('item', 'module'))) {
                     //seems to work anyway in the admin module page - so lets not raise notice
                     JError::raiseNotice(500, 'Model not set in listfields field ' . $this->id);
                 }
                 echo "form model no set";
                 return;
             }
             $listModel = $this->form->model;
             if ($id !== 0) {
                 $formModel = $listModel->getFormModel();
                 $valfield = $valueformat == 'tableelement' ? 'name' : 'id';
                 $res = $formModel->getElementOptions(false, $valfield, $onlylistfields, false, $pluginFilters);
             } else {
                 $res = array();
             }
             break;
         case 'form':
             if (!isset($this->form->model)) {
                 JError::raiseNotice(500, 'Model not set in listfields field ' . $this->id);
                 return;
             }
             $formModel = $this->form->model;
             $valfield = $valueformat == 'tableelement' ? 'name' : 'id';
             $res = $formModel->getElementOptions(false, $valfield, $onlylistfields, false, $pluginFilters);
             break;
         default:
             return JText::_('THE LISTFIELDS ELEMENT IS ONLY USABLE BY LISTS AND ELEMENTS');
             break;
     }
     $return = '';
     if (is_array($res)) {
         if ($controller == 'element') {
             foreach ($res as $o) {
                 $s = new stdClass();
                 //element already contains correct key
                 if ($controller != 'element') {
                     $s->value = $valueformat == 'tableelement' ? $o->table_name . '.' . $o->text : $o->value;
                 } else {
                     $s->value = $o->value;
                 }
                 $s->text = FabrikString::getShortDdLabel($o->text);
                 $aEls[] = $s;
             }
         } else {
             foreach ($res as &$o) {
                 $o->text = FabrikString::getShortDdLabel($o->text);
             }
             $aEls = $res;
         }
         $aEls[] = JHTML::_('select.option', '', '-');
         // for pk fields - we are no longer storing the key with '`' as thats mySQL specific
         $this->value = str_replace('`', '', $this->value);
         $return = JHTML::_('select.genericlist', $aEls, $this->name, 'class="inputbox" size="1" ', 'value', 'text', $this->value, $this->id);
         $return .= "<img style=\"margin-left:10px;display:none\" id=\"" . $this->id . "_loader\" src=\"components/com_fabrik/images/ajax-loader.gif\" alt=\"" . JText::_('LOADING') . "\" />";
     }
     return $return;
 }
开发者ID:romuland,项目名称:khparts,代码行数:101,代码来源:listfields.php

示例6: ajax_fields

	function ajax_fields()
	{
		$tid = JRequest::getVar('t');
		$keyType = JRequest::getVar('k', 1);
		$showAll = JRequest::getVar('showall', false);//if true show all fields if false show fabrik elements

		//only used if showall = false, includes validations as separate entries
		$incCalculations = JRequest::getVar('calcs', false);
		$arr = array(JHTML::_('select.option', '', JText::_('COM_FABRIK_PLEASE_SELECT'), 'value', 'label'));
		if ($showAll) { //show all db columns
			$cid = JRequest::getVar('cid', -1);
			$cnn = JModel::getInstance('Connection', 'FabrikFEModel');
			$cnn->setId($cid);
			$db = $cnn->getDb();
			if ($tid != '') {
				$db->setQuery("DESCRIBE ".$db->nameQuote($tid));

				$rows = $db->loadObjectList();
				if (is_array($rows)) {
					foreach ($rows as $r) {
						$c = new stdClass();
						$c->value = $r->Field;
						$c->label = $r->Field;
						$arr[] = $c; //dont use =
					}
				}
			}
		} else {
			//show fabrik elements in the table
			//$keyType 1 = $element->id;
			//$keyType 2 = tablename___elementname
			$model = JModel::getInstance('List', 'FabrikFEModel');
			$model->setId($tid);
			$table = $model->getTable();
			$groups = $model->getFormGroupElementData();
			$published = JRequest::getVar('published', false);
			$showintable = JRequest::getVar('showintable', false);
			foreach ($groups as $g => $groupModel) {
				if ($groupModel->isJoin()) {
					if (JRequest::getVar('excludejoined') == 1) {
						continue;
					}
					$joinModel = $groupModel->getJoinModel();
					$join = $joinModel->getJoin();
				}
				if ($published == true) {
					$elementModels = $groups[$g]->getPublishedElements();
				} else {
					$elementModels = $groups[$g]->getMyElements();
				}

				foreach ($elementModels as $e => $eVal) {
					$element = $eVal->getElement();
					if ($showintable == true && $element->show_in_list_summary == 0) {
						continue;
					}
					if ($keyType == 1) {
						$v = $element->id;
					} else {
						//@TODO if in repeat group this is going to add [] to name - is this really
						// what we want? In timeline viz options i've simply stripped out the [] off the end
						// as a temp hack
						$v = $eVal->getFullName(false);
					}
					$c = new stdClass();
					$c->value = $v;
					$label = FabrikString::getShortDdLabel( $element->label);
					if ($groupModel->isJoin()) {
						$label = $join->table_join.'.'.$label;
					}
					$c->label = $label;
					$arr[] = $c; //dont use =
					if ($incCalculations) {
						$params = $eVal->getParams();
						if ($params->get('sum_on', 0)) {
							$c = new stdClass();
							$c->value = 'sum___'.$v;
							$c->label = JText::_('COM_FABRIK_SUM') . ": " .$label;
							$arr[] = $c; //dont use =
						}
						if ($params->get('avg_on', 0)) {
							$c = new stdClass();
							$c->value = 'avg___'.$v;
							$c->label = JText::_('COM_FABRIK_AVERAGE') . ": " .$label;
							$arr[] = $c; //dont use =
						}
						if ($params->get('median_on', 0)) {
							$c = new stdClass();
							$c->value = 'med___'.$v;
							$c->label = JText::_('COM_FABRIK_MEDIAN') . ": " .$label;
							$arr[] = $c; //dont use =
						}
						if ($params->get('count_on', 0)) {
							$c = new stdClass();
							$c->value = 'cnt___'.$v;
							$c->label = JText::_('COM_FABRIK_COUNT') . ": " .$label;
							$arr[] = $c; //dont use =
						}
					}
				}
//.........这里部分代码省略.........
开发者ID:Jobar87,项目名称:fabrik,代码行数:101,代码来源:plugin.php

示例7: getInput


//.........这里部分代码省略.........
                 $o->table_name = '';
                 $o->name = '';
                 $o->value = '';
                 $o->text = JText::_('COM_FABRIK_SELECT_A_TABLE_FIRST');
                 $res[] = $o;
             }
             break;
         case 'listform':
         case 'list':
         case 'module':
         case 'item':
             // Menu item
             if ($controller === 'item') {
                 $id = $this->form->getValue('request.listid');
             } else {
                 $id = $this->form->getValue('id');
             }
             if (!isset($this->form->model)) {
                 if (!in_array($controller, array('item', 'module'))) {
                     // Seems to work anyway in the admin module page - so lets not raise notice
                     $app->enqueueMessage('Model not set in listfields field ' . $this->id, 'notice');
                 }
                 return;
             }
             $listModel = $this->form->model;
             if ($id !== 0) {
                 $formModel = $listModel->getFormModel();
                 $valfield = $valueformat == 'tableelement' ? 'name' : 'id';
                 $res = $formModel->getElementOptions($useStep, $valfield, $onlylistfields, $showRaw, $pluginFilters, $labelMethod, $nojoins);
             } else {
                 $res = array();
             }
             break;
         case 'form':
             if (!isset($this->form->model)) {
                 throw new RuntimeException('Model not set in listfields field ' . $this->id);
                 return;
             }
             $formModel = $this->form->model;
             $valfield = $valueformat == 'tableelement' ? 'name' : 'id';
             $res = $formModel->getElementOptions($useStep, $valfield, $onlylistfields, $showRaw, $pluginFilters, $labelMethod, $nojoins);
             $jsres = $formModel->getElementOptions($useStep, $valfield, $onlylistfields, $showRaw, $pluginFilters, $labelMethod, $nojoins);
             array_unshift($jsres, JHTML::_('select.option', '', JText::_('COM_FABRIK_PLEASE_SELECT')));
             $this->js($jsres);
             break;
         case 'group':
             $valfield = $valueformat == 'tableelement' ? 'name' : 'id';
             $id = $this->form->getValue('id');
             $groupModel = JModelLegacy::getInstance('Group', 'FabrikFEModel');
             $groupModel->setId($id);
             $formModel = $groupModel->getFormModel();
             $res = $formModel->getElementOptions($useStep, $valfield, $onlylistfields, $showRaw, $pluginFilters, $labelMethod, $nojoins);
             break;
         default:
             return JText::_('The ListFields element is only usable by lists and elements');
             break;
     }
     $return = '';
     if (is_array($res)) {
         if ($controller == 'element') {
             foreach ($res as $o) {
                 $s = new stdClass();
                 // Element already contains correct key
                 if ($controller != 'element') {
                     $s->value = $valueformat == 'tableelement' ? $o->table_name . '.' . $o->text : $o->value;
                 } else {
                     $s->value = $o->value;
                 }
                 $s->text = FabrikString::getShortDdLabel($o->text);
                 $aEls[] = $s;
             }
         } else {
             foreach ($res as &$o) {
                 $o->text = FabrikString::getShortDdLabel($o->text);
             }
             $aEls = $res;
         }
         // Paul - Prepend rather than append "none" option.
         array_unshift($aEls, JHTML::_('select.option', '', '-'));
         // For pk fields - we are no longer storing the key with '`' as that's mySQL specific
         $this->value = str_replace('`', '', $this->value);
         // Some elements were stored as names but subsequently changed to ids (need to check for old values an substitute with correct ones)
         if ($valueformat == 'id' && !is_numeric($this->value) && $this->value != '') {
             if ($formModel) {
                 $elementModel = $formModel->getElement($this->value);
                 $this->value = $elementModel ? $elementModel->getId() : $this->value;
             }
         }
         if ($mode === 'gui') {
             $this->js($aEls);
             $return = $this->gui();
         } else {
             $return = JHTML::_('select.genericlist', $aEls, $this->name, 'class="inputbox" size="1" ', 'value', 'text', $this->value, $this->id);
             $return .= '<img style="margin-left:10px;display:none" id="' . $this->id . '_loader" src="components/com_fabrik/images/ajax-loader.gif" alt="' . JText::_('LOADING') . '" />';
         }
     }
     FabrikHelperHTML::framework();
     FabrikHelperHTML::iniRequireJS();
     return $return;
 }
开发者ID:ppantilla,项目名称:bbninja,代码行数:101,代码来源:listfields.php

示例8: fetchElement


//.........这里部分代码省略.........
                     }
                     $db->setQuery("select group_id from #__fabrik_elements where id = " . (int) $cid);
                     $groupid = $db->loadResult();
                 }
                 $oGroup->setId($groupid);
                 $formModel =& $oGroup->getForm();
                 $optskey = $node->attributes('valueformat', 'tableelement') == 'tableelement' ? 'name' : 'id';
                 $onlytablefields = (int) $node->attributes('onlytablefields', 0);
                 $res = $formModel->getElementOptions(false, $optskey, $onlytablefields, false, $pluginFilters);
                 $hash = "{$controller}." . implode('.', $bits);
                 if (array_key_exists($hash, $this->results)) {
                     $res = $this->results[$hash];
                 } else {
                     $this->results[$hash] =& $res;
                 }
             } else {
                 //****************************//
                 $repeat = ElementHelper::getRepeat($this);
                 $tableDd = $node->attributes('table', '');
                 FabrikHelperHTML::script('tablefields.js', 'administrator/components/com_fabrik/elements/', true);
                 $opts = new stdClass();
                 $opts->table = $repeat ? 'params' . $tableDd . "-" . $c : 'params' . $tableDd;
                 $opts->livesite = COM_FABRIK_LIVESITE;
                 $opts->conn = 'params' . $connectionDd;
                 $opts->value = $value;
                 $opts->repeat = $value;
                 $opts = FastJSON::encode($opts);
                 $script = "window.addEvent('domready', function() {\n";
                 $script .= "new tablefieldsElement('{$id}', {$opts});\n";
                 $script .= "});\n";
                 $document =& JFactory::getDocument();
                 $document->addScriptDeclaration($script);
                 $rows = array(JHTML::_('select.option', '', JText::_('SELECT A CONNECTION FIRST')), 'value', 'text');
                 $o = new stdClass();
                 $o->table_name = '';
                 $o->name = '';
                 $o->value = '';
                 $o->text = JText::_('SELECT A TABLE FIRST');
                 $res[] = $o;
                 //****************************//
             }
             break;
         case 'table':
             $id = $this->_parent->get('id', false);
             if ($id === false) {
                 $id = JRequest::getVar('cid', array(0));
                 if (is_array($id)) {
                     $id = $id[0];
                 }
             }
             $tableModel =& $session->get('com_fabrik.admin.table.edit.model');
             $formModel =& $tableModel->getForm();
             $valfield = $node->attributes('valueformat', 'tableelement') == 'tableelement' ? 'name' : 'id';
             $onlytablefields = (int) $node->attributes('onlytablefields', 1);
             $incraw = $node->attributes('incraw', 0) == 1 ? true : false;
             $res = $formModel->getElementOptions(false, $valfield, $onlytablefields, $incraw, $pluginFilters);
             break;
         case 'form':
             $id = $this->_parent->get('id');
             $id = JRequest::getVar('cid', array(0));
             if (is_array($id)) {
                 $id = $id[0];
             }
             $formModel =& $session->get('com_fabrik.admin.form.edit.model');
             $valfield = $node->attributes('valueformat', 'tableelement') == 'tableelement' ? 'name' : 'id';
             $onlytablefields = (int) $node->attributes('onlytablefields', 1);
             $incraw = $node->attributes('incraw', 0) == 1 ? true : false;
             $res = $formModel->getElementOptions(false, $valfield, $onlytablefields, $incraw, $pluginFilters);
             break;
         default:
             return JText::_('THE TABLEFIELDS ELEMENT IS ONLY USABLE BY TABLES AND ELEMENTS');
             break;
     }
     $return = '';
     if (is_array($res)) {
         if ($controller == 'element') {
             foreach ($res as $o) {
                 $s = new stdClass();
                 //element already contains correct key
                 if ($controller != 'element') {
                     $s->value = $node->attributes('valueformat', 'tableelement') == 'tableelement' ? $o->table_name . '.' . $o->text : $o->value;
                 } else {
                     $s->value = $o->value;
                 }
                 $s->text = FabrikString::getShortDdLabel($o->text);
                 $aEls[] = $s;
             }
         } else {
             foreach ($res as &$o) {
                 $o->text = FabrikString::getShortDdLabel($o->text);
             }
             $aEls = $res;
         }
         $id = ElementHelper::getId($this, $control_name, $name);
         $aEls[] = JHTML::_('select.option', '', '-');
         $return = JHTML::_('select.genericlist', $aEls, $fullName, 'class="inputbox" size="1" ', 'value', 'text', $value, $id);
         $return .= "<img style='margin-left:10px;display:none' id='" . $id . "_loader' src='components/com_fabrik/images/ajax-loader.gif' alt='" . JText::_('LOADING') . "' />";
     }
     return $return;
 }
开发者ID:nikshade,项目名称:fabrik21,代码行数:101,代码来源:tablefields.php


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