本文整理汇总了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;
}
示例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;
}
}
示例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);
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
示例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);
}
示例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);
}
示例11: publish
public function publish(&$pks, $value = 1)
{
if (parent::publish($pks, $value)) {
$this->updateCounter();
return true;
} else {
return false;
}
}
示例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);
}
示例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;
}
}
示例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;
}
}
示例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);
}