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


PHP JModelAdmin::publish方法代码示例

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


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

示例1: publish

 public function publish(&$pks, $value = 1)
 {
     $table = $this->getTable('Comment', 'JUDownloadTable');
     $new_pks = array();
     while (!empty($pks)) {
         $pk = array_shift($pks);
         $new_pks[] = $pk;
         $table->reset();
         if (!$table->load($pk)) {
             if ($error = $table->getError()) {
                 $this->setError($error);
             }
             return false;
         }
         $db = $this->getDbo();
         $query = $db->getQuery(true);
         $query->clear();
         $query->select('id');
         $query->from('#__judownload_comments');
         $query->where('lft > ' . (int) $table->lft);
         $query->where('rgt < ' . (int) $table->rgt);
         $db->setQuery($query);
         $childIds = $db->loadColumn();
         foreach ($childIds as $childId) {
             if (!in_array($childId, $pks)) {
                 array_push($pks, $childId);
             }
         }
         $commentId = $pk;
         if (!parent::publish($pk, $value)) {
             return false;
         }
         JUDownloadFrontHelperMail::sendEmailByEvent('comment.editstate', $commentId);
         $logData = array('user_id' => $table->user_id, 'event' => 'comment.editstate', 'item_id' => $commentId, 'doc_id' => $table->doc_id, 'value' => $value, 'reference' => '');
         JUDownloadFrontHelperLog::addLog($logData);
     }
     $pks = $new_pks;
     return true;
 }
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:39,代码来源:comment.php

示例2: publish

 /**
  * Method to change the published state of one or more records.
  *
  * @param   array    $pks    A list of the primary keys to change.
  * @param   integer  $value  The value of the published state.
  *
  * @return  boolean  True on success.
  *
  * @since   2.5
  */
 function publish(&$pks, $value = 1)
 {
     if (parent::publish($pks, $value)) {
         // Initialise variables.
         $dispatcher = JDispatcher::getInstance();
         $extension = JRequest::getCmd('extension');
         // Include the content plugins for the change of category state event.
         JPluginHelper::importPlugin('content');
         // Trigger the onCategoryChangeState event.
         $dispatcher->trigger('onCategoryChangeState', array($extension, $pks, $value));
         return true;
     }
 }
开发者ID:vuchannguyen,项目名称:hoctap,代码行数:23,代码来源:category.php

示例3: publish

 /**
  * Checks that the current user matches the message recipient and calls the parent publish method
  *
  * @param   array    &$pks   A list of the primary keys to change.
  * @param   integer  $value  The value of the published state.
  *
  * @return  boolean  True on success.
  *
  * @since   3.1
  */
 public function publish(&$pks, $value = 1)
 {
     $user = JFactory::getUser();
     $table = $this->getTable();
     $pks = (array) $pks;
     // Check that the recipient matches the current user
     foreach ($pks as $i => $pk) {
         $table->reset();
         if ($table->load($pk)) {
             if ($table->user_id_to != $user->id) {
                 // Prune items that you can't change.
                 unset($pks[$i]);
                 JLog::add(JText::_('JLIB_APPLICATION_ERROR_EDITSTATE_NOT_PERMITTED'), JLog::WARNING, 'jerror');
                 return false;
             }
         }
     }
     return parent::publish($pks, $value);
 }
开发者ID:deenison,项目名称:joomla-cms,代码行数:29,代码来源:message.php

示例4: publish

 /**
  * Method to change the published state of one or more records.
  *
  * @param	array	$pks	A list of the primary keys to change.
  * @param	int		$value	The value of the published state.
  *
  * @return	boolean	True on success.
  * @since	1.6
  */
 function publish(&$pks, $value = 1)
 {
     // Initialise variables.
     $table = $this->getTable();
     $pks = (array) $pks;
     // Default menu item existence checks.
     if ($value != 1) {
         foreach ($pks as $i => $pk) {
             if ($table->load($pk) && $table->home && $table->language == '*') {
                 // Prune items that you can't change.
                 JError::raiseWarning(403, JText::_('JLIB_DATABASE_ERROR_MENU_UNPUBLISH_DEFAULT_HOME'));
                 unset($pks[$i]);
                 break;
             }
         }
     }
     // Clean the cache
     $this->cleanCache();
     return parent::publish($pks, $value);
 }
开发者ID:akksi,项目名称:jcg,代码行数:29,代码来源:item.php

示例5: publish

	/**
	 * Method to change the published state of one or more records.
	 *
	 * @param	array	$pks	A list of the primary keys to change.
	 * @param	int		$value	The value of the published state.
	 *
	 * @return	boolean	True on success.
	 * @since	1.6
	 */
	function publish(&$pks, $value = 1)
	{
		$result = parent::publish($pks, $value);
		
		// Clean extra cache for newsfeeds
		$this->cleanCache('feed_parser');

		return $result;
	}
开发者ID:ronildo,项目名称:minima,代码行数:18,代码来源:newsfeed.php

示例6: publish

 /**
  * Method to change the published state of one or more records.
  *
  * @param   array    &$pks   A list of the primary keys to change.
  * @param   integer  $value  The value of the published state.
  *
  * @return  boolean  True on success.
  *
  * @since   12.2
  */
 public function publish(&$pks, $value = 1)
 {
     if (!parent::publish($pks, $value)) {
         return false;
     }
     return true;
 }
开发者ID:vdm-io,项目名称:Joomla-Component-Builder,代码行数:17,代码来源:help_document.php

示例7: publish

 public function publish(&$pks, $value = 1)
 {
     $session = JFactory::getSession();
     $fields = array('state', 'published_once');
     $pk_key = true;
     $olddata = $this->getItems($pks, $fields, $pk_key);
     $publish = parent::publish($pks, $value);
     if (!$publish) {
         return false;
     }
     $fields = '*';
     $newdata = $this->getItemsExtended($pks, $fields, $pk_key);
     //igualando os itens ja que a diferenca consiste somente em 'state' e 'published_once'
     foreach ($olddata as $k => $old_item) {
         $copy = $newdata[$k];
         $copy->state = $old_item->state;
         $copy->published_once = $old_item->published_once;
         $old_item = (array) $copy;
         $new_item = (array) $newdata[$k];
         $new_item['state'] = $value;
         $compromissoAlterado = $this->isCompromissoAlterado($new_item, $old_item);
         if ($compromissoAlterado) {
             $this->updateAgendaAlteradaInfo($new_item);
         }
         if (!$this->updateCompromissosDirigentes($new_item, $compromissoAlterado, $old_item)) {
             $session->set('msg_ao_menos_um_sobreposto', 0);
             $session->set('msg_sobreposicoes_na_publicacao', 0);
             return false;
         }
     }
     $session->set('msg_ao_menos_um_sobreposto', 0);
     $session->set('msg_sobreposicoes_na_publicacao', 0);
     return true;
 }
开发者ID:carloslimasis,项目名称:joomla-3.x,代码行数:34,代码来源:compromisso.php

示例8: publish

 /**
  * Method to publish a recordset
  * @param array $pks array of id's
  * @param boolean $value wether to publish or unpublish
  * @return type
  */
 public function publish(&$pks, $value = 1)
 {
     $pks = (array) $pks;
     // Look for restrictions.
     foreach ($pks as $i => $pk) {
         $restrictions = $this->getRestrictions($pk);
         if (is_array($restrictions) && count($restrictions) > 0) {
             //Give an error message
             JFactory::getApplication()->enqueueMessage(JText::sprintf("COM_VISFORMS_FIELD_HAS_RESTICTIONS", $pk), 'warning');
             //unset the pk
             unset($pks[$i]);
         }
     }
     return parent::publish($pks, $value);
 }
开发者ID:shamusdougan,项目名称:GDMCWebsite,代码行数:21,代码来源:visfield.php

示例9: publish

 /**
  * Method to change the published state of one or more records.
  *
  * @param	array	$pks	A list of the primary keys to change.
  * @param	int		$value	The value of the published state.
  *
  * @return	boolean	True on success.
  * @since	1.6
  */
 function publish(&$pks, $value = 1)
 {
     // Initialise variables.
     $table = $this->getTable();
     $pks = (array) $pks;
     // Clean the cache
     $this->cleanCache();
     return parent::publish($pks, $value);
 }
开发者ID:jmangarret,项目名称:webtuagencia24,代码行数:18,代码来源:excursion.php

示例10: publish

 /**
  * Checks that the current user matches the message recipient and calls the parent publish method
  *
  * @param   array    &$pks   A list of the primary keys to change.
  * @param   integer  $value  The value of the published state.
  *
  * @return  boolean  True on success.
  *
  * @since   3.1
  */
 public function publish(&$pks, $value = 1)
 {
     $table = $this->getTable();
     $pks = (array) $pks;
     // Check that the recipient matches the current user
     foreach ($pks as $i => $pk) {
         $table->reset();
         if ($table->load($pk)) {
             if ($table->user_id_to !== \User::get('id')) {
                 // Prune items that you can't change.
                 unset($pks[$i]);
                 \Notify::warning(\Lang::txt('JLIB_APPLICATION_ERROR_EDITSTATE_NOT_PERMITTED'));
                 return false;
             }
         }
     }
     return parent::publish($pks, $value);
 }
开发者ID:mined-gatech,项目名称:hubzero-cms,代码行数:28,代码来源:message.php

示例11: publish

 public function publish(&$pks, $value = 1)
 {
     if (parent::publish($pks, $value)) {
         $this->updateCounter();
         return true;
     } else {
         return false;
     }
 }
开发者ID:Tommar,项目名称:remate,代码行数:9,代码来源:comment.php

示例12: publish

 public function publish(&$pks, $value = 1)
 {
     $table = $this->getTable();
     $pks = (array) $pks;
     // Clean the cache
     $this->cleanCache();
     // Ensure that previous checks doesn't empty the array
     if (empty($pks)) {
         return true;
     }
     return parent::publish($pks, $value);
 }
开发者ID:ForAEdesWeb,项目名称:AEW3,代码行数:12,代码来源:module.php

示例13: publish

 /**
  * Method to change the published state of one or more records.
  *
  * @param   array    $pks    A list of the primary keys to change.
  * @param   integer  $value  The value of the published state.
  *
  * @return  boolean  True on success.
  *
  * @since   2.5
  */
 function publish(&$pks, $value = 1)
 {
     if (parent::publish($pks, $value)) {
         // Initialise variables.
         $extension = Request::getCmd('extension');
         // Trigger the onCategoryChangeState event.
         Event::trigger('content.onCategoryChangeState', array($extension, $pks, $value));
         return true;
     }
 }
开发者ID:mined-gatech,项目名称:hubzero-cms,代码行数:20,代码来源:category.php

示例14: publish

 /**
  * Method to change the published state of one or more records.
  *
  * @param   array    &$pks   A list of the primary keys to change.
  * @param   integer  $value  The value of the published state.
  *
  * @return  boolean  True on success.
  *
  * @since   2.5
  */
 public function publish(&$pks, $value = 1)
 {
     if (parent::publish($pks, $value)) {
         $dispatcher = JEventDispatcher::getInstance();
         $extension = JFactory::getApplication()->input->get('extension');
         // Include the content plugins for the change of category state event.
         JPluginHelper::importPlugin('content');
         // Trigger the onCategoryChangeState event.
         $dispatcher->trigger('onCategoryChangeState', array($extension, $pks, $value));
         return true;
     }
 }
开发者ID:ajodochus,项目名称:joomlaForDocker,代码行数:22,代码来源:category.php

示例15: publish

 /**
  * Method to change the published state of one or more records.
  *
  * @param   array       &$pks   A list of the primary keys to change.
  * @param   integer     $value  The value of the published state.
  *
  * @return  boolean  True on success.
  *
  * @since   1.6
  */
 public function publish(&$pks, $value = 1)
 {
     $table = $this->getTable();
     $pks = (array) $pks;
     // Default menu item existence checks.
     if ($value != 1) {
         foreach ($pks as $i => $pk) {
             if ($table->load($pk) && $table->home && $table->language == '*') {
                 // Prune items that you can't change.
                 JFactory::getApplication()->enqueueMessage(JText::_('JLIB_DATABASE_ERROR_MENU_UNPUBLISH_DEFAULT_HOME'), 'error');
                 unset($pks[$i]);
                 break;
             }
         }
     }
     // Clean the cache
     $this->cleanCache();
     // Ensure that previous checks doesn't empty the array
     if (empty($pks)) {
         return true;
     }
     return parent::publish($pks, $value);
 }
开发者ID:joomlatools,项目名称:joomla-platform,代码行数:33,代码来源:item.php


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