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


PHP object::getElement方法代码示例

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


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

示例1: setProgressElement

 /**
  * Attach a progress bar to this monitor.
  *
  * @param      object    $bar           a html_progress instance
  *
  * @return     void
  * @since      1.1
  * @access     public
  * @throws     HTML_PROGRESS_ERROR_INVALID_INPUT
  * @see        getProgressElement()
  */
 function setProgressElement($bar)
 {
     if (!is_a($bar, 'HTML_Progress')) {
         return $this->_progress->raiseError(HTML_PROGRESS_ERROR_INVALID_INPUT, 'exception', array('var' => '$bar', 'was' => gettype($bar), 'expected' => 'HTML_Progress object', 'paramnum' => 1));
     }
     $this->_progress = $bar;
     $bar =& $this->_form->getElement('progressBar');
     $bar->setText($this->_progress->toHtml());
 }
开发者ID:Ogwang,项目名称:sainp,代码行数:20,代码来源:monitor.php

示例2: setProgressElement

 /**
  * Attach a progress bar to this monitor.
  *
  * @param      object    $bar           a html_progress instance
  *
  * @return     void
  * @since      1.1
  * @access     public
  * @throws     HTML_PROGRESS_ERROR_INVALID_INPUT
  * @see        getProgressElement()
  */
 function setProgressElement($bar)
 {
     if (!is_a($bar, 'HTML_Progress')) {
         return Error_Raise::raise($this->_package, HTML_PROGRESS_ERROR_INVALID_INPUT, 'exception', array('var' => '$bar', 'was' => gettype($bar), 'expected' => 'HTML_Progress object', 'paramnum' => 1), PEAR_ERROR_TRIGGER);
     }
     $this->_progress = $bar;
     $this->_progress->addListener($this);
     $bar =& $this->_form->getElement('progressBar');
     $bar->setText($this->_progress->toHtml());
 }
开发者ID:BackupTheBerlios,项目名称:urulu-svn,代码行数:21,代码来源:monitor.php

示例3: setProgressElement

 /**
  * Attach a progress bar to this uploader.
  *
  * @param      object    $bar           a html_progress instance
  *
  * @return     void
  * @since      1.1
  * @access     public
  * @throws     HTML_PROGRESS_ERROR_INVALID_INPUT
  */
 function setProgressElement(&$bar)
 {
     if (!is_a($bar, 'HTML_Progress')) {
         return Error_Raise::raise($this->_package, HTML_PROGRESS_ERROR_INVALID_INPUT, 'exception', array('var' => '$bar', 'was' => gettype($bar), 'expected' => 'HTML_Progress object', 'paramnum' => 1), PEAR_ERROR_TRIGGER);
     }
     $this->_progress =& $bar;
     $this->_progress->setStringPainted(true);
     // get space for the string
     $this->_progress->setString("");
     // but don't paint it
     $this->_progress->setIndeterminate(true);
     $bar =& $this->_form->getElement('progressBar');
     $bar->setText($this->_progress->toHtml());
 }
开发者ID:BackupTheBerlios,项目名称:urulu-svn,代码行数:24,代码来源:uploader.php

示例4: tryForLabel

/**
 * Will attempt to get the element for the posted key
 *
 * @param   object  $formModel  Form model
 * @param   string  $key        POST key value
 *
 * @return  array(label, is the key a raw element, should we show the element)
 */
function tryForLabel($formModel, $key, $raw, $info)
{
    $elementModel = $formModel->getElement($key);
    $label = $key;
    $thisRaw = false;
    if ($elementModel) {
        $label = $elementModel->getElement()->label;
    } else {
        if (substr($key, -4) == '_raw') {
            $thisRaw = true;
            $key = substr($key, 0, strlen($key) - 4);
            $elementModel = $formModel->getElement($key);
            if ($elementModel) {
                $label = $elementModel->getElement()->label . ' (raw)';
            }
        }
    }
    $show = true;
    if ($thisRaw && !$raw || !$elementModel && !$info) {
        $show = false;
    }
    return array($label, $thisRaw, $show);
}
开发者ID:jfquestiaux,项目名称:fabrik,代码行数:31,代码来源:debug_with_labels.php

示例5: array

 /**
  * LiveUser_Auth_Container_XML::_updateUserData()
  *
  * Writes current values for user back to the database.
  * This method does nothing in the base class and is supposed to
  * be overridden in subclasses according to the supported backend.
  *
  * @access private
  */
 function _updateUserData()
 {
     if (!$this->init_ok || !$this->userObj) {
         return false;
     }
     $data = array('lastLogin' => $this->currentLogin);
     $index = 0;
     foreach ($this->userObj->children as $value) {
         if (in_array($value->name, array_keys($data))) {
             $el =& $this->userObj->getElement(array($index));
             $el->setContent($data[$value->name]);
         }
         $index++;
     }
     $success = false;
     do {
         $fp = fopen($this->file, 'wb');
         if (!$fp) {
             $errorMsg = "Auth freeze failure. Failed to open the xml file.";
             break;
         }
         if (!flock($fp, LOCK_EX)) {
             $errorMsg = "Auth freeze failure. Couldn't get an exclusive lock on the file.";
             break;
         }
         if (!fwrite($fp, $this->tree->get())) {
             $errorMsg = "Auth freeze failure. Write error when writing back the file.";
             break;
         }
         @fflush($fp);
         $success = true;
     } while (false);
     @flock($fp, LOCK_UN);
     @fclose($fp);
     if (!$success) {
         return LiveUser::raiseError(LIVEUSER_ERROR, null, null, $errorMsg);
     }
     return $success;
 }
开发者ID:BackupTheBerlios,项目名称:hem,代码行数:48,代码来源:XML.php

示例6: upload

 /**
  * upload and move the file if valid to the uploaded directory
  *
  * @param object $page       the CRM_Core_Form object
  * @param object $data       the QFC data container
  * @param string $pageName   the name of the page which index the data container with
  * @param string $uploadName the name of the uploaded file
  *
  * @return void
  * @access private
  */
 function upload(&$page, &$data, $pageName, $uploadName)
 {
     if (empty($uploadName)) {
         return;
     }
     // get the element containing the upload
     $element =& $page->getElement($uploadName);
     if ('file' == $element->getType()) {
         if ($element->isUploadedFile()) {
             // rename the uploaded file with a unique number at the end
             $value = $element->getValue();
             $newName = uniqid("{$value['name']}.");
             $status = $element->moveUploadedFile($this->_uploadDir, $newName);
             if (!$status) {
                 CRM_Utils_System::statusBounce(ts('We could not move the uploaded file %1 to the upload directory %2. Please verify that the CIVICRM_IMAGE_UPLOADDIR setting points to a valid path which is writable by your web server.', array(1 => $value['name'], 2 => $this->_uploadDir)));
             }
             if (!empty($data['values'][$pageName][$uploadName])) {
                 @unlink($this->_uploadDir . $data['values'][$pageName][$uploadName]);
             }
             $data['values'][$pageName][$uploadName] = $this->_uploadDir . $newName;
         }
     }
 }
开发者ID:bhirsch,项目名称:voipdrupal-4.7-1.0,代码行数:34,代码来源:Upload.php

示例7: foreach

 /**
  * DB_DataObject_FormBuilder_QuickForm::_freezeFormElements()
  *
  * Freezes a list of form elements (set read-only).
  * Used in _generateForm().
  *
  * @param object $form               The form object in question
  * @param array  $elements_to_freeze List of element names to be frozen
  * @access protected
  * @see DB_DataObject_FormBuilder::_generateForm()
  */
 function _freezeFormElements(&$form, $elementsToFreeze)
 {
     foreach ($elementsToFreeze as $elementToFreeze) {
         $elementToFreeze = $this->getFieldName($elementToFreeze);
         if ($form->elementExists($elementToFreeze)) {
             $el =& $form->getElement($elementToFreeze);
             $el->freeze();
         }
     }
 }
开发者ID:GeekyNinja,项目名称:LifesavingCAD,代码行数:21,代码来源:QuickForm.php

示例8: shouldUpdateElement

 /**
  * called at the end of saving an element
  * if a new element it will run the sql to add to field,
  * if existing element and name changed will create query to be used later
  * @param object $elementModel
  * @param string $origColName
  * @return array($update, $q, $oldName, $newdesc, $origDesc, $dropKey)
  */
 public function shouldUpdateElement(&$elementModel, $origColName = null)
 {
     $db = FabrikWorker::getDbo();
     $return = array(false, '', '', '', '', false);
     $element =& $elementModel->getElement();
     $pluginManager =& $this->getPluginManager();
     $basePlugIn =& $pluginManager->getPlugIn($element->plugin, 'element');
     $fbConfig =& JComponentHelper::getParams('com_fabrik');
     $fabrikDb = $this->getDb();
     $group =& $elementModel->getGroup();
     $dropKey = false;
     //$$$ rob - replaced this with getting the table from the group as if we moved the element
     //from one group to another $this->getTable gives you the old group's table, where as we want
     // the new group's table
     //$table 			=& $this->getTable();
     $table =& $group->getlistModel()->getTable();
     // $$$ rob - if we are saving an element that wasn't attached to a group then we should
     // get the table id from the group's table
     if ($table->id == '') {
         $table =& $group->getlistModel()->getTable();
     }
     // $$$ hugh - if this is a table-less form ... not much point going any
     // further 'cos things will go BANG
     if (empty($table->id)) {
         return $return;
     }
     if ($this->isView()) {
         return $return;
     }
     if ($group->isJoin()) {
         $tableName = $group->getJoinModel()->getJoin()->table_join;
         $keydata = $keydata[0];
         $primaryKey = $keydata['colname'];
     } else {
         $tableName = $table->db_table_name;
         $primaryKey = $table->db_primary_key;
     }
     $keydata = $this->getPrimaryKeyAndExtra($tableName);
     // $$$ rob base plugin needs to know group info for date fields in non-join repeat groups
     $basePlugIn->_group =& $elementModel->_group;
     $objtype = $elementModel->getFieldDescription();
     //the element type AFTER saving
     $dbdescriptions = $this->getDBFields($tableName, 'Field');
     if (!$this->canAlterFields()) {
         $objtype = $dbdescriptions[$origColName]->Type;
     }
     if (is_null($objtype)) {
         return $return;
     }
     $existingfields = array_keys($dbdescriptions);
     $lastfield = $existingfields[count($existingfields) - 1];
     $tableName = FabrikString::safeColName($tableName);
     $lastfield = FabrikString::safeColName($lastfield);
     $altered = false;
     if (!array_key_exists($element->name, $dbdescriptions)) {
         if ($origColName == '') {
             $fabrikDb->setQuery("ALTER TABLE {$tableName} ADD COLUMN " . FabrikString::safeColName($element->name) . " {$objtype} AFTER {$lastfield}");
             if (!$fabrikDb->query()) {
                 return JError::raiseError(500, 'alter structure: ' . $fabrikDb->getErrorMsg());
             }
             $altered = true;
         }
         // commented out as it stops the update when changing an element name
         //return $return;
     }
     $thisFieldDesc = JArrayHelper::getValue($dbdescriptions, $origColName, new stdClass());
     // $$$ rob the Default property for timestamps when they are set to CURRENT_TIMESTAMP
     // doesn't show up from getDBFields()  - so presuming a timestamp field will always default
     // to the current timestamp (update of the field's data controller in the Extra property (on update CURRENT_TIMESTAMP)
     $existingDef = '';
     if (isset($thisFieldDesc->Type)) {
         $existingDef = $thisFieldDesc->Type;
         if ($thisFieldDesc->Type == 'timestamp') {
             $existingDef .= $thisFieldDesc->Null = 'YES' ? ' NULL' : ' NOT NULL';
             $existingDef .= ' DEFAULT CURRENT_TIMESTAMP';
             $existingDef .= ' ' . $thisFieldDesc->Extra;
         }
     }
     //if its the primary 3.0
     for ($k = 0; $k < count($keydata); $k++) {
         if ($keydata[$k]['colname'] == $origColName) {
             $existingDef .= " " . $keydata[$k]['extra'];
         }
     }
     if (!is_null($objtype)) {
         $lowerobjtype = strtolower(trim($objtype));
         $lowerobjtype = str_replace(' not null', '', $lowerobjtype);
         if ($element->name == $origColName && strtolower(trim($existingDef)) == $lowerobjtype) {
             //no chanages to the element name or field type
             return $return;
         }
         $return[4] = $existingDef;
//.........这里部分代码省略.........
开发者ID:juliano-hallac,项目名称:fabrik,代码行数:101,代码来源:list.php

示例9: getMap

 /**
  * get the data map to transform web service data into list data
  * @param	object	$formModel
  * @return	array	data map
  */
 protected function getMap($formModel)
 {
     $params = $this->getParams();
     $map = json_decode($params->get('webservice_map'));
     $return = array();
     $from = $map->map_from;
     $to = $map->map_to;
     $match = $map->map_match;
     $value = $map->map_value;
     $eval = $map->map_eval;
     $n = count($from);
     for ($i = 0; $i < $n; $i++) {
         $tid = $formModel->getElement($to[$i], true)->getElement()->name;
         $return[] = array('from' => $from[$i], 'to' => $tid, 'value' => $value[$i], 'match' => $match[$i], 'eval' => (bool) $eval[$i]);
     }
     return $return;
 }
开发者ID:rhotog,项目名称:fabrik,代码行数:22,代码来源:webservice.php

示例10: getRepeatElementTableName

 /**
  * Get the name of the repeated elements table
  *
  * @param   object $elementModel element model
  * @param   object $row          element item
  *
  * @return  string    table name
  */
 protected function getRepeatElementTableName($elementModel, $row = null)
 {
     $listModel = $elementModel->getListModel();
     $groupModel = $elementModel->getGroupModel();
     if (is_null($row)) {
         $row = $elementModel->getElement();
     }
     if ($groupModel->isJoin()) {
         $origTableName = $groupModel->getJoinModel()->getJoin()->table_join;
     } else {
         $origTableName = $listModel->getTable()->db_table_name;
     }
     return $origTableName . '_repeat_' . str_replace('`', '', $row->name);
 }
开发者ID:LGBGit,项目名称:tierno,代码行数:22,代码来源:element.php

示例11: add_unit_fields

    /**
     * Add the input areas for each unit.
     * @param object $mform the form being built.
     */
    protected function add_unit_fields($mform) {
        $repeated = array(
            $mform->createElement('header', 'unithdr',
                    get_string('unithdr', 'qtype_numerical', '{no}')),
            $mform->createElement('text', 'unit', get_string('unit', 'quiz')),
            $mform->createElement('text', 'multiplier', get_string('multiplier', 'quiz')),
        );

        $repeatedoptions['unit']['type'] = PARAM_NOTAGS;
        $repeatedoptions['multiplier']['type'] = PARAM_NUMBER;
        $repeatedoptions['unit']['disabledif'] =
                array('unitrole', 'eq', qtype_numerical::UNITNONE);
        $repeatedoptions['multiplier']['disabledif'] =
                array('unitrole', 'eq', qtype_numerical::UNITNONE);

        if (isset($this->question->options->units)) {
            $countunits = count($this->question->options->units);
        } else {
            $countunits = 0;
        }
        if ($this->question->formoptions->repeatelements) {
            $repeatsatstart = $countunits + 1;
        } else {
            $repeatsatstart = $countunits;
        }
        $this->repeat_elements($repeated, $repeatsatstart, $repeatedoptions, 'nounits',
                'addunits', 2, get_string('addmoreunitblanks', 'qtype_calculated', '{no}'));

        if ($mform->elementExists('multiplier[0]')) {
            $firstunit = $mform->getElement('multiplier[0]');
            $firstunit->freeze();
            $firstunit->setValue('1.0');
            $firstunit->setPersistantFreeze(true);
            $mform->addHelpButton('multiplier[0]', 'numericalmultiplier', 'qtype_numerical');
        }
    }
开发者ID:nottmoo,项目名称:moodle,代码行数:40,代码来源:edit_numerical_form.php

示例12: getRepeatElementTableName

 /**
  * Get the name of the repeated elements table
  *
  * @param   object  $elementModel  element model
  * @param   object  $row           element item
  *
  * @return  string	table name
  */
 protected function getRepeatElementTableName($elementModel, $row = null)
 {
     $listModel = $elementModel->getListModel();
     if (is_null($row)) {
         $row = $elementModel->getElement();
     }
     $origTableName = $listModel->getTable()->db_table_name;
     return $origTableName . '_repeat_' . str_replace('`', '', $row->name);
 }
开发者ID:rogeriocc,项目名称:fabrik,代码行数:17,代码来源:element.php

示例13: linkHref

 /**
  * Get the href for the edit/details link
  *
  * @param   object  $elementModel   Element model
  * @param   array   $row            Lists current row data
  * @param   int     $repeatCounter  Repeat group counter
  *
  * @since   2.0.4
  *
  * @return  string	link href
  */
 public function linkHref($elementModel, $row, $repeatCounter = 0)
 {
     $element = $elementModel->getElement();
     $table = $this->getTable();
     $params = $elementModel->getParams();
     $customLink = $params->get('custom_link');
     $link = '';
     if ($customLink == '') {
         // $$$ rob only test canEdit and canView on standard edit links - if custom we should always use them,
         // 3.0 get either edit or view link - as viewDetailsLink now always returns the view details link
         if ($this->canEdit($row)) {
             $this->_aLinkElements[] = $element->name;
             $link = $this->editLink($row);
         } elseif ($this->canViewDetails($row)) {
             $this->_aLinkElements[] = $element->name;
             $link = $this->viewDetailsLink($row);
         }
     } else {
         $array = ArrayHelper::fromObject($row);
         foreach ($array as $k => &$v) {
             /* $$$ hugh - not everything is JSON, some stuff is just plain strings.
              * So we need to see if JSON encoding failed, and only use result if it didn't.
              * $v = json_decode($v, true);
              */
             if (is_array($v)) {
                 $v = FArrayHelper::getValue($v, $repeatCounter);
             } else {
                 $v2 = json_decode($v, true);
                 if ($v2 !== null) {
                     if (is_array($v2)) {
                         $v = FArrayHelper::getValue($v2, $repeatCounter);
                     } else {
                         $v = $v2;
                     }
                 }
             }
         }
         $array['rowid'] = $this->getSlug($row);
         $array['listid'] = $table->id;
         $link = JRoute::_($this->parseMessageForRowHolder($customLink, $array));
     }
     // Allow creating custom links, default layout will just return $link unaltered
     $layout = FabrikHelperHTML::getLayout('element.fabrik-element-details-link');
     $displayData = new stdClass();
     $displayData->row = $row;
     $displayData->listModel = $this;
     $displayData->elementModel = $elementModel;
     $displayData->customLink = $customLink;
     $displayData->repeatCounter = $repeatCounter;
     $displayData->link = $link;
     $link = $layout->render($displayData);
     return $link;
 }
开发者ID:pascal26,项目名称:fabrik,代码行数:64,代码来源:list.php

示例14: indQueryString

 /**
  * Insert individual querystring filter into filter array
  *
  * @param   object  $elementModel  element model
  * @param   array   &$filters      filter array
  * @param   mixed   $value         value
  * @param   string  $condition     condition
  * @param   string  $join          join
  * @param   bool    $grouped       is grouped
  * @param   bool    $eval          is eval
  * @param   string  $key           element key
  * @param   bool    $raw           is the filter a raw filter (tablename___elementname_raw=foo)
  *
  * @return  void
  */
 private function indQueryString($elementModel, &$filters, $value, $condition, $join, $grouped, $eval, $key, $raw = false)
 {
     $input = $this->app->input;
     $element = $elementModel->getElement();
     $elParams = $elementModel->getParams();
     if (is_string($value)) {
         $value = trim($value);
     }
     $k2 = FabrikString::safeColNameToArrayKey($key);
     /**
      * $$$ rob fabrik_sticky_filters set in J content plugin
      * Treat these as prefilters so we don't unset them
      * when we clear the filters
      */
     $stickyFilters = $input->get('fabrik_sticky_filters', array(), 'array');
     $filterType = in_array($k2 . '_raw', $stickyFilters) || in_array($k2, $stickyFilters) ? 'jpluginfilters' : 'querystring';
     $filters['value'][] = $value;
     $filters['condition'][] = urldecode($condition);
     $filters['join'][] = $join;
     $filters['no-filter-setup'][] = $element->filter_type == '' ? 1 : 0;
     $filters['hidden'][] = $element->filter_type == '' ? 1 : 0;
     $filters['key'][] = $key;
     $filters['key2'][] = '';
     $filters['search_type'][] = $filterType;
     $filters['match'][] = $element->filter_exact_match;
     $filters['full_words_only'][] = $elParams->get('full_words_only');
     $filters['eval'][] = $eval;
     $filters['required'][] = $elParams->get('filter_required');
     $filters['access'][] = $elParams->get('filter_access');
     $filters['grouped_to_previous'][] = $grouped;
     $filters['label'][] = $elementModel->getListHeading();
     $filters['elementid'][] = $element->id;
     $filters['raw'][] = $raw;
 }
开发者ID:LGBGit,项目名称:tierno,代码行数:49,代码来源:listfilter.php

示例15: triggered

 /**
  * Test if the notifications should be fired
  *
  * @param   object  $formModel  form model
  * @param   JRegistry  $params  params
  *
  * @return  bool
  */
 protected function triggered($formModel, $params)
 {
     if ($params->get('send_mode', 0) == 0) {
         $user = JFactory::getUser();
         return $user->get('id') == 0 ? false : true;
     } else {
         $triggerEl = $formModel->getElement($params->get('trigger'), true);
         $trigger = $triggerEl->getFullName();
         $data = $formModel->getData();
         return JArrayHelper::getValue($data, $trigger) == $params->get('trigger_value') ? true : false;
     }
 }
开发者ID:rogeriocc,项目名称:fabrik,代码行数:20,代码来源:notification.php


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