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


PHP JModelLegacy::getItem方法代码示例

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


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

示例1: postSaveHook

 public function postSaveHook(JModelLegacy $model, $validData = array())
 {
     $item = $model->getItem();
     $sport_id = $item->get('id');
     $this->saveconfigs($sport_id);
     $this->setRedirect(JRoute::_('index.php?option=com_htraininglogs&view=cfgsport&layout=edit&id=' . $sport_id, false));
 }
开发者ID:hogeh,项目名称:htraininglogs2,代码行数:7,代码来源:cfgsport.php

示例2: postSaveHook

 public function postSaveHook(JModelLegacy $model, $validData = array())
 {
     $item = $model->getItem();
     $map_id = $item->get('id');
     $mapimage = $item->get('mapimage');
     $this->prepare_fileupload($map_id, $mapimage);
     //in case new HR file added
     $this->setRedirect(JRoute::_('index.php?option=com_htraininglogs&view=omap&layout=edit&id=' . $map_id, false));
 }
开发者ID:hogeh,项目名称:htraininglogs2,代码行数:9,代码来源:omap.php

示例3: postSaveHook

 public function postSaveHook(JModelLegacy $model, $validData = array())
 {
     $item = $model->getItem();
     $sub_id = $item->get('id');
     $sport_id = $item->get('sport_id');
     $this->saveomap();
     $split_id = $this->prepare_fileupload($sub_id, $sport_id);
     //in case new HR file added
     $this->setRedirect(JRoute::_('index.php?option=com_htraininglogs&view=session&layout=edit&sub_id=' . $sub_id . '&split_id=' . $split_id, false));
 }
开发者ID:hogeh,项目名称:htraininglogs2,代码行数:10,代码来源:session.php

示例4: postSaveHook

 public function postSaveHook(JModelLegacy $model, $validData = array())
 {
     $item = $model->getItem();
     $media_id = $item->get('id');
     $mediafile = JRequest::getVar('filename');
     $model->storeimage($mediafile, $media_id);
     $this->prepare_fileupload($media_id, $mediafile);
     //in case new m fedia file added
     //$this->setRedirect(JRoute::_('index.php?option=com_htraininglogs&view=media&layout=edit&id='.$media_id, false));
 }
开发者ID:hogeh,项目名称:htraininglogs2,代码行数:10,代码来源:media.php

示例5: postSaveHook

 protected function postSaveHook(JModelLegacy $model, $validData = array())
 {
     $item = $model->getItem();
     $id = $item->get('id');
     if ($id) {
         if ($validData['saveresult'] == 1) {
             //Create a new datatable if it doesn't allready exist
             if (!$model->createDataTables($id)) {
                 $this->setMessage($model->getError());
             }
         }
     }
 }
开发者ID:shamusdougan,项目名称:GDMCWebsite,代码行数:13,代码来源:visform.php

示例6: postSaveHook

 protected function postSaveHook(JModelLegacy $model, $validData = array())
 {
     $item = $model->getItem();
     $id = $item->get('id');
     $fid = $item->get('fid');
     if ($fid && $id) {
         $db = JFactory::getDbo();
         // Test if data must be saved in DB for this form
         $query = ' SELECT * from #__visforms c where c.id=' . $fid . ' ';
         $db->setQuery($query);
         $forms = $db->loadObjectList();
         if (count($forms) > 0) {
             $rowTable = $forms[0];
             if ($rowTable->saveresult == 1) {
                 $model->createDataTableFields($fid, $id);
             }
         }
     }
 }
开发者ID:shamusdougan,项目名称:GDMCWebsite,代码行数:19,代码来源:visfield.php

示例7: postSaveHook

 /**
  * Function that allows child controller access to model data after the data has been saved.
  *
  * @param   JModelLegacy  $model      The data model object.
  * @param   array         $validData  The validated data.
  *
  * @return  void
  * @since   3.1
  */
 protected function postSaveHook(JModelLegacy $model, $validData = array())
 {
     $task = $this->getTask();
     $item = $model->getItem();
     if (isset($item->params) && is_array($item->params)) {
         $registry = new JRegistry();
         $registry->loadArray($item->params);
         $item->params = (string) $registry;
     }
     if (isset($item->metadata) && is_array($item->metadata)) {
         $registry = new JRegistry();
         $registry->loadArray($item->metadata);
         $item->metadata = (string) $registry;
     }
     $id = $item->id;
     return;
 }
开发者ID:GitIPFire,项目名称:Homeworks,代码行数:26,代码来源:category.php

示例8: postSaveHook

 protected function postSaveHook(JModelLegacy $model, $validData = array())
 {
     //A: inform log table about the new issue
     if ($validData['id'] == 0) {
         $log = JTable::getInstance('Log', 'ImcTable', array());
         $catTitle = ImcFrontendHelper::getCategoryNameByCategoryId($validData['catid']);
         $data2['id'] = 0;
         $data2['state'] = 1;
         $data2['action'] = JText::_('COM_IMC_LOGS_ACTION_INITIAL_COMMIT');
         $data2['issueid'] = $model->getItem()->get('id');
         $data2['stepid'] = $validData['stepid'];
         $data2['description'] = JText::_('COM_IMC_LOGS_ACTION_INITIAL_COMMIT') . ' ' . JText::_('COM_IMC_LOGS_AT_CATEGORY') . ' ' . $catTitle;
         $data2['created'] = $validData['created'];
         $data2['created_by'] = $validData['created_by'];
         $data2['updated'] = $validData['created'];
         $data2['language'] = $validData['language'];
         $data2['rules'] = $validData['rules'];
         if (!$log->bind($data2)) {
             JFactory::getApplication()->enqueueMessage('Cannot bind data to log table', 'error');
         }
         if (!$log->save($data2)) {
             JFactory::getApplication()->enqueueMessage('Cannot save data to log table', 'error');
         }
         try {
             $dispatcher = JEventDispatcher::getInstance();
             $results = $dispatcher->trigger('onAfterNewIssueAdded', array($model, $validData));
             // Check the returned results. This is for plugins that don't throw
             // exceptions when they encounter serious errors.
             if (in_array(false, $results)) {
                 throw new Exception($dispatcher->getError(), 500);
             }
         } catch (Exception $e) {
             // Handle a caught exception.
             throw $e;
         }
     } else {
         //a. check for step modification
         if (isset($validData['is_step_modified']) && $validData['is_step_modified'] === 'true') {
             $user = JFactory::getUser();
             $log = JTable::getInstance('Log', 'ImcTable', array());
             $data2['id'] = 0;
             $data2['state'] = 1;
             $data2['action'] = JText::_('COM_IMC_LOGS_ACTION_STEP_MODIFIED');
             $data2['issueid'] = $validData['id'];
             $data2['stepid'] = $validData['stepid'];
             $data2['description'] = $validData['step_modified_description'];
             $data2['created'] = $validData['updated'];
             $data2['created_by'] = $user->id;
             $data2['updated'] = $validData['updated'];
             $data2['language'] = $validData['language'];
             $data2['rules'] = $validData['rules'];
             if (!$log->bind($data2)) {
                 JFactory::getApplication()->enqueueMessage('Cannot bind data to log table', 'error');
             }
             if (!$log->save($data2)) {
                 JFactory::getApplication()->enqueueMessage('Cannot save data to log table', 'error');
             }
             $dispatcher = JEventDispatcher::getInstance();
             $dispatcher->trigger('onAfterStepModified', array($model, $validData));
         }
         //b. check for category modification
         if (isset($validData['is_category_modified']) && $validData['is_category_modified'] === 'true') {
             $user = JFactory::getUser();
             $log = JTable::getInstance('Log', 'ImcTable', array());
             $data2['id'] = 0;
             $data2['state'] = 1;
             $data2['action'] = JText::_('COM_IMC_LOGS_ACTION_CATEGORY_MODIFIED');
             $data2['issueid'] = $validData['id'];
             $data2['stepid'] = $validData['stepid'];
             $data2['description'] = $validData['category_modified_description'];
             $data2['created'] = $validData['updated'];
             $data2['created_by'] = $user->id;
             $data2['updated'] = $validData['updated'];
             $data2['language'] = $validData['language'];
             $data2['rules'] = $validData['rules'];
             if (!$log->bind($data2)) {
                 JFactory::getApplication()->enqueueMessage('Cannot bind data to log table', 'error');
             }
             if (!$log->save($data2)) {
                 JFactory::getApplication()->enqueueMessage('Cannot save data to log table', 'error');
             }
             $dispatcher = JEventDispatcher::getInstance();
             $dispatcher->trigger('onAfterCategoryModified', array($model, $validData));
         }
     }
     //B: move any images only if record is new
     if ($validData['id'] == 0) {
         //check if any files uploaded
         $obj = json_decode($validData['photo']);
         if (empty($obj->files)) {
             return;
         }
         $srcDir = JPATH_ROOT . '/' . $obj->imagedir . '/' . $obj->id;
         $dstDir = JPATH_ROOT . '/' . $obj->imagedir . '/' . $model->getItem()->get('id');
         $success = rename($srcDir, $dstDir);
         if ($success) {
             //update photo json isnew, id
             unset($obj->isnew);
             $obj->id = $model->getItem()->get('id');
             $photo = json_encode($obj);
//.........这里部分代码省略.........
开发者ID:Ricardolau,项目名称:imc,代码行数:101,代码来源:issue.php

示例9: getItem

 public function getItem($pk = null)
 {
     $item = parent::getItem($pk);
     return $item;
 }
开发者ID:gorgozilla,项目名称:Estivole,代码行数:5,代码来源:calendars.php

示例10: postSaveHook

 /**
  * Function that allows child controller access to model data after the data has been saved.
  *
  * @param   JModelLegacy  $model      The data model object.
  * @param   array         $validData  The validated data.
  *
  * @return  void
  *
  * @since   3.1
  */
 protected function postSaveHook(JModelLegacy $model, $validData = array())
 {
     $item = $model->getItem();
     if (isset($item->params) && is_array($item->params)) {
         $registry = new Registry($item->params);
         $item->params = (string) $registry;
     }
     if (isset($item->metadata) && is_array($item->metadata)) {
         $registry = new Registry($item->metadata);
         $item->metadata = (string) $registry;
     }
 }
开发者ID:eshiol,项目名称:joomla-cms,代码行数:22,代码来源:category.php

示例11: onAfterSave

 /**
  * Executes after the row is saved and saves the category relationship info
  *
  * @param   JModelLegacy  $model  - the model
  * @param   array         $data   - the valid data
  *
  * @return bool
  */
 public function onAfterSave($model, $data)
 {
     $db = JFactory::getDbo();
     $cats = $data['catid'];
     $item = $model->getItem();
     /**
      * Let's wipe out the customfield-category table
      * I always have to do that, otherwise I could have some problems when
      * a field changes from 'all' to 'category'
      */
     $query = $db->getQuery(true)->delete('#__compojoom_customfields_cats')->where('compojoom_customfields_id = ' . $item->id);
     if (!$db->setQuery($query)->execute()) {
         $this->setError(JText::_('COM_HOTSPOTS_CUSTOMFIELDS_ERR_DELETE_CATS'));
         return false;
     }
     if ($cats && $data['show'] == 'category') {
         $query = $db->getQuery(true)->insert('#__compojoom_customfields_cats')->columns('compojoom_customfields_id, catid');
         foreach ($cats as $cat) {
             if (!$cat) {
                 continue;
             }
             $query->values($item->id . ', ' . $cat);
         }
         if (!$db->setQuery($query)->execute()) {
             $this->setError(JText::_('COM_HOTSPOTS_CUSTOMFIELDS_ERR_INSERT_CATS'));
             return false;
         }
     }
     return true;
 }
开发者ID:compojoom,项目名称:lib_compojoom,代码行数:38,代码来源:customfield.php

示例12: postSaveHook

 /**
  * Function that allows child controller access to model data after the data has been saved.
  *
  * @param   JModelLegacy  $model      The data model object.
  * @param   array         $validData  The validated data.
  *
  * @return	void
  *
  * @since	1.6
  */
 protected function postSaveHook(JModelLegacy $model, $validData = array())
 {
     $task = $this->getTask();
     $item = $model->getItem();
     if (!$model->getsports($item->user_id)) {
         $model->createsports($item->user_id);
         $model->createportlets($item->user_id);
         $model->createmediadirs($item->user_id);
     }
     //print_r($item);print_r($task);exit;
     if ($task == 'save') {
         $this->setRedirect(JRoute::_('index.php?option=com_htraininglogs&view=htraininglogs', false));
     }
 }
开发者ID:hogeh,项目名称:htraininglogs2,代码行数:24,代码来源:htraininglog.php


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