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


PHP JModelAdmin::canDelete方法代码示例

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


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

示例1: canDelete

 /**
  * Method to test whether a record can be deleted.
  *
  * @param   object	A record object.
  * @return  boolean  True if allowed to delete the record. Defaults to the permission set in the component.
  * @since   1.6
  */
 protected function canDelete($record)
 {
     if (!empty($record->id)) {
         $user = JFactory::getUser();
         // Check that user have access permission to data banks and can delete
         if ($user->authorise('core.core', $this->option) && parent::canDelete($record)) {
             // Check that desease not used in these tables
             $tables = array('dairies', 'fruits', 'sweeteners', 'prescriptions', 'foods', 'compositions');
             $db = JFactory::getDbo();
             foreach ($tables as $table) {
                 $query = $db->getQuery(true);
                 $query->select("COUNT(s.id) AS scount");
                 $query->from('#__sibdiet_' . $table . ' AS s');
                 $query->where("s.compositions LIKE '%\"" . $record->id . "\":%'");
                 $db->setQuery($query);
                 try {
                     // Execute the query in Joomla 3.0.
                     $compositionUsed = $db->loadResult();
                 } catch (Exception $e) {
                     // catch any database errors.
                 }
                 if ($compositionUsed) {
                     // echo that item is used
                     $this->setError(JText::sprintf('COM_SIBDIET_ERR_COMPOSITION_USED', $record->title));
                     return;
                 }
             }
             return true;
         }
         return;
     }
 }
开发者ID:smhnaji,项目名称:sdnet,代码行数:39,代码来源:composition.php

示例2: canDelete

 /**
  * Метод для проверки, может ли пользователь удалять существующую запись.
  *
  * @param   object  $record  Объект записи.
  *
  * @return  boolean  True, если разрешено удалять запись.
  */
 protected function canDelete($record)
 {
     if (!empty($record->id)) {
         return JFactory::getUser()->authorise('core.delete', $this->option . '.message.' . (int) $record->id);
     } else {
         return parent::canDelete($record);
     }
 }
开发者ID:thebeuving,项目名称:joomla-25-component-example,代码行数:15,代码来源:helloworld.php

示例3: canDelete

 /**
  * Method to test whether a record can be deleted.
  *
  * @param   object  $record  A record object.
  *
  * @return  boolean  True if allowed to delete the record. Defaults to the permission for the component.
  *
  * @since   1.0.0
  */
 protected function canDelete($record)
 {
     if (!empty($record->id)) {
         if ($record->catid) {
             return JFactory::getUser()->authorise('core.delete', 'com_digicom.discount.' . (int) $record->catid);
         }
         return parent::canDelete($record);
     }
 }
开发者ID:Shtier,项目名称:digicom,代码行数:18,代码来源:discount.php

示例4: canDelete

 /**
  * Method to test whether a record can be deleted.
  *
  * @param	object	$record	A record object.
  *
  * @return	boolean	True if allowed to delete the record. Defaults to the permission set in the component.
  * @since	1.6
  */
 protected function canDelete($record)
 {
     $user = JFactory::getUser();
     if ($record->catid) {
         return $user->authorise('core.delete', 'com_contact.category.' . (int) $record->catid);
     } else {
         return parent::canDelete($record);
     }
 }
开发者ID:reechalee,项目名称:joomla1.6,代码行数:17,代码来源:contact.php

示例5: canDelete

 protected function canDelete($record)
 {
     if ($record->home) {
         // default record cannot be deleted
         return false;
     } else {
         return parent::canDelete($record);
     }
 }
开发者ID:Lothurm,项目名称:J3.x,代码行数:9,代码来源:jt_theme.php

示例6: canDelete

 /**
  * Method to test whether a record can be deleted.
  *
  * @param   object    A record object.
  *
  * @return  boolean  True if allowed to delete the record. Defaults to the permission set in the component.
  * @since   1.6
  */
 protected function canDelete($record)
 {
     if (!empty($record->id)) {
         if ($record->published != -2) {
             return;
         }
         return parent::canDelete($record);
     }
 }
开发者ID:woakes070048,项目名称:joomlatools-platform,代码行数:17,代码来源:item.php

示例7: canDelete

 protected function canDelete($record)
 {
     $user = JFactory::getUser();
     if (!empty($record->catid)) {
         return $user->authorise('core.delete', 'com_phocagallery.phocagalleryco.' . (int) $record->catid);
     } else {
         return parent::canDelete($record);
     }
 }
开发者ID:scarsroga,项目名称:blog-soa,代码行数:9,代码来源:phocagalleryco.php

示例8: canDelete

 protected function canDelete($record)
 {
     $user = JFactory::getUser();
     /*if ($record->catid) {
     			return $user->authorise('core.delete', 'com_phocagallery.phocagalleryuser');
     		} else {*/
     return parent::canDelete($record);
     //}
 }
开发者ID:optimosolution,项目名称:marhk,代码行数:9,代码来源:phocagalleryuser.php

示例9: canDelete

 /**
  * Method to test whether a record can be deleted.
  *
  * @param   object  $record  A record object.
  *
  * @return  boolean  True if allowed to delete the record. Defaults to the permission set in the component.
  *
  * @since   3.1
  */
 protected function canDelete($record)
 {
     if (!empty($record->id)) {
         if ($record->published != -2) {
             return;
         }
         $user = JFactory::getUser();
         return parent::canDelete($record);
     }
 }
开发者ID:GitIPFire,项目名称:Homeworks,代码行数:19,代码来源:tag.php

示例10: canDelete

 /**
  * Method to test whether a record can be deleted.
  *
  * @param   object  $record  A record object.
  *
  * @return  boolean  True if allowed to delete the record. Defaults to the permission for the component.
  *
  * @since   1.6
  */
 protected function canDelete($record)
 {
     if (!empty($record->id)) {
         if ($record->state != -2) {
             return;
         }
         if ($record->catid) {
             return JFactory::getUser()->authorise('core.delete', 'com_htraininglogs.category.' . (int) $record->catid);
         }
         return parent::canDelete($record);
     }
 }
开发者ID:hogeh,项目名称:htraininglogs,代码行数:21,代码来源:htraininglog.php

示例11: canDelete

 /**
  * Method to test whether a record can be deleted.
  *
  * @param	object	A record object.
  * @return	boolean	True if allowed to delete the record. Defaults to the permission set in the component.
  * @since	1.6
  */
 protected function canDelete($record)
 {
     if (!empty($record->id)) {
         if ($record->state != -2) {
             return;
         }
         $user = JFactory::getUser();
         if ($record->catid) {
             return $user->authorise('core.delete', 'com_faqs.category.' . (int) $record->catid);
         } else {
             return parent::canDelete($record);
         }
     }
 }
开发者ID:bubujie,项目名称:xixia,代码行数:21,代码来源:faq.php

示例12: canDelete

 /**
  * Method to test whether a record can be deleted.
  *
  * @param   object  $record  A record object.
  *
  * @return  boolean  True if allowed to delete the record. Defaults to the permission for the component.
  *
  * @since   1.0.0
  */
 protected function canDelete($record)
 {
     if (!empty($record->id)) {
         if ($record->published != -2) {
             return;
         }
         if (!$this->checkOrderExist($record->id)) {
             return;
         }
         if ($record->catid) {
             return JFactory::getUser()->authorise('core.delete', 'com_digicom.category.' . (int) $record->catid);
         }
         return parent::canDelete($record);
     }
 }
开发者ID:Shtier,项目名称:digicom,代码行数:24,代码来源:product.php

示例13: canDelete

 /**
  * Method to test whether a record can be deleted.
  *
  * @param	object	$record	A record object.
  *
  * @return	boolean	True if allowed to delete the record. Defaults to the permission set in the component.
  * @since	1.6
  */
 protected function canDelete($record)
 {
     // Check if the access level is being used by any content.
     if ($this->levelsInUse === null) {
         // Populate the list once.
         $this->levelsInUse = array();
         $db = $this->getDbo();
         $query = $db->getQuery(true)->select('DISTINCT access');
         // from is added dynamically
         // Get all the tables and the prefix
         $tables = $db->getTableList();
         //$fields = $db->getTableFields($tables);
         $prefix = $db->getPrefix();
         foreach ($tables as $table) {
             // Get all of the columns in the table
             $fields = $db->getTableColumns($table);
             // We are looking for the access field.  If custom tables are using something other
             // than the 'access' field they are on their own unfortunately.
             // Also make sure the table prefix matches the live db prefix (eg, it is not a "bak_" table)
             if (strpos($table, $prefix) === 0 && isset($fields['access'])) {
                 // Lookup the distinct values of the field.
                 $query->clear('from')->from($db->quoteName($table));
                 $db->setQuery($query);
                 $values = $db->loadColumn();
                 $error = $db->getErrorMsg();
                 // Check for DB error.
                 if ($error) {
                     $this->setError($error);
                     return false;
                 }
                 $this->levelsInUse = array_merge($this->levelsInUse, $values);
                 // TODO Could assemble an array of the tables used by each view level list those,
                 // giving the user a clue in the error where to look.
             }
         }
         // Get uniques.
         $this->levelsInUse = array_unique($this->levelsInUse);
         // Ok, after all that we are ready to check the record :)
     }
     if (in_array($record->id, $this->levelsInUse)) {
         $this->setError(JText::sprintf('COM_USERS_ERROR_VIEW_LEVEL_IN_USE', $record->id, $record->title));
         return false;
     }
     return parent::canDelete($record);
 }
开发者ID:christianesperar,项目名称:joomla-example,代码行数:53,代码来源:level.php

示例14: canDelete

 /**
  * Method to test whether a record can be deleted.
  *
  * @param
  *        	object A record object.
  * @return boolean True if allowed to delete the record. Defaults to the permission set in the component.
  * @since 1.6
  */
 protected function canDelete($record)
 {
     if (!empty($record->id)) {
         if ($record->published != -2) {
             return;
         }
         $user = JFactory::getUser();
         if (!empty($record->catid)) {
             $canDelete = $user->authorise('core.delete', 'com_edashboard.category.' . (int) $record->catid);
         } else {
             $canDelete = parent::canDelete($record);
         }
     }
     // ABP: Additional check on pub dates: deny if published, only superadmin can change
     if ($canDelete && !$user->authorise('core.admin') && $record->id) {
         $item = $this->getItem($record->id);
         $canDelete = !$this->isPublished($item);
     }
     return $canDelete;
 }
开发者ID:site4com,项目名称:acts,代码行数:28,代码来源:post.php

示例15: canDelete

 /**
  * Method to test whether a record can be deleted.
  *
  * @param   object  $record  A record object.
  *
  * @return  boolean  True if allowed to delete the record. Defaults to the permission for the component.
  *
  * @since   1.6
  */
 protected function canDelete($record)
 {
     if (!empty($record->id)) {
         if ($record->state != -2) {
             return;
         }
         $user = JFactory::getUser();
         // Check that desease not used in given diets
         $db = JFactory::getDbo();
         $query = $db->getQuery(true)->select("q.id")->from('#__testyourself_questions AS q')->where("q.formid = " . $record->id);
         $db->setQuery($query);
         try {
             $used = $db->loadColumn();
         } catch (Exception $e) {
             // catch any database errors.
         }
         if (count($used)) {
             // echo that item is used
             $this->setError(JText::sprintf('COM_TESTYOURSELF_ERR_FORM_USED', $record->title . ' (' . implode(' - ', $used) . ')'));
             return;
         }
         return parent::canDelete($record);
     }
 }
开发者ID:smhnaji,项目名称:sdnet,代码行数:33,代码来源:form.php


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