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


PHP nnText::fixDateOffset方法代码示例

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


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

示例1: save

 /**
  * Method to save the form data.
  *
  * @param   array  $data  The form data.
  *
  * @return  boolean  True on success.
  *
  * @since   1.6
  */
 public function save($data)
 {
     $advancedparams = JFactory::getApplication()->input->get('advancedparams', array(), 'array');
     $dispatcher = JEventDispatcher::getInstance();
     $input = JFactory::getApplication()->input;
     $table = $this->getTable();
     $pk = !empty($data['id']) ? $data['id'] : (int) $this->getState('module.id');
     $isNew = true;
     $context = $this->option . '.' . $this->name;
     // Include the plugins for the save event.
     JPluginHelper::importPlugin('extension');
     // Load the row if saving an existing record.
     if ($pk > 0) {
         $table->load($pk);
         $isNew = false;
     }
     // Alter the title and published state for Save as Copy
     if ($input->get('task') == 'save2copy') {
         $orig_table = clone $this->getTable();
         $orig_table->load((int) $input->getInt('id'));
         $data['published'] = 0;
         if ($data['title'] == $orig_table->title) {
             $data['title'] .= ' ' . JText::_('JGLOBAL_COPY');
         }
     }
     require_once JPATH_PLUGINS . '/system/nnframework/helpers/text.php';
     // correct the publish date details
     if (isset($advancedparams['assignto_date_publish_up'])) {
         nnText::fixDateOffset($advancedparams['assignto_date_publish_up']);
     }
     if (isset($advancedparams['assignto_date_publish_down'])) {
         nnText::fixDateOffset($advancedparams['assignto_date_publish_down']);
     }
     if (isset($advancedparams['assignto_date'])) {
         $publish_up = 0;
         $publish_down = 0;
         if ($advancedparams['assignto_date'] == 2) {
             $publish_up = $advancedparams['assignto_date_publish_down'];
         } else {
             if ($advancedparams['assignto_date'] == 1) {
                 $publish_up = $advancedparams['assignto_date_publish_up'];
                 $publish_down = $advancedparams['assignto_date_publish_down'];
             }
         }
         $data['publish_up'] = $publish_up;
         $data['publish_down'] = $publish_down;
     }
     $lang = '*';
     if (isset($advancedparams['assignto_languages']) && $advancedparams['assignto_languages'] == 1 && count($advancedparams['assignto_languages_selection']) === 1) {
         $lang = (string) $advancedparams['assignto_languages_selection']['0'];
     }
     $data['language'] = $lang;
     // Bind the data.
     if (!$table->bind($data)) {
         $this->setError($table->getError());
         return false;
     }
     // Prepare the row for saving
     $this->prepareTable($table);
     // Check the data.
     if (!$table->check()) {
         $this->setError($table->getError());
         return false;
     }
     // Trigger the before save event.
     $result = $dispatcher->trigger($this->event_before_save, array($context, &$table, $isNew));
     if (in_array(false, $result, true)) {
         $this->setError($table->getError());
         return false;
     }
     // Store the data.
     if (!$table->store()) {
         $this->setError($table->getError());
         return false;
     }
     $table_adv = JTable::getInstance('AdvancedModules', 'AdvancedModulesTable');
     $table_adv->moduleid = $table->id;
     if ($table_adv->moduleid && !$table_adv->load($table_adv->moduleid)) {
         $db = $table_adv->getDbo();
         $db->insertObject($table_adv->getTableName(), $table_adv, $table_adv->getKeyName());
     }
     if (isset($data['rules'])) {
         $table_adv->_title = $data['title'];
         $table_adv->setRules($data['rules']);
     }
     $table_adv->params = json_encode($advancedparams);
     // Check the row
     $table_adv->check();
     // Store the row
     if (!$table_adv->store()) {
         $this->setError($table_adv->getError());
//.........这里部分代码省略.........
开发者ID:ranrolls,项目名称:ras-full-portal,代码行数:101,代码来源:module.php


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