/content/code/trunk/modules/mod_artofcontent_add/helper.php
PHP | 88 lines | 34 code | 10 blank | 44 comment | 3 complexity | e8def19608a59ca9d37c37fbe0404cfc MD5 | raw file
- <?php
- /**
- * @version $Id:combolayout.php 2547 2007-11-10 04:37:15Z masterchief $
- * @package NewLifeInIT
- * @subpackage mod_artofcontent_add
- * @copyright Copyright 2005 - 2010 New Life in IT Pty Ltd. All rights reserved.
- * @license GNU General Public License <http://www.gnu.org/copyleft/gpl.html>
- * @author Andrew Eddie <andrew.eddie@newlifeinit.com>
- * @link http://www.theartofjoomla.com/extensions/artof-content.html
- */
- // No direct access.
- defined('JPATH_BASE') or die();
- /**
- * Artof Content Add module helper.
- *
- * @package NewLifeInIT
- * @subpackage mod_artofcontent_add
- * @since 1.0
- */
- class modArtofContentAddHelper
- {
- /**
- * Check if we can add an article to the active category (if there is one).
- *
- * @return boolean
- * @since 1.0
- */
- public static function canAdd()
- {
- // Look for the marker in the state.
- $app = JFactory::getApplication();
- if (self::isAdmin()) {
- return true;
- }
- else {
- return $app->get('com_artofcontent.core.create');
- }
- }
- /**
- * Get the category id.
- *
- * @return int
- * @since 1.0
- */
- public static function getCategoryId()
- {
- // Look for the marker in the state.
- $app = JFactory::getApplication();
- return (int) $app->get('com_artofcontent.category_id');
- }
- /**
- * Get the category id.
- *
- * @return int
- * @since 1.0
- */
- public static function getSectionId()
- {
- // Look for the marker in the state.
- $app = JFactory::getApplication();
- return (int) $app->get('com_artofcontent.section_id');
- }
- /**
- * Check if this user is an Admin.
- *
- * @return boolean
- * @since 1.0
- */
- protected function isAdmin()
- {
- static $result;
- if ($result === null) {
- $user = JFactory::getUser();
- $result = in_array($user->get('gid'), array(25, 24, 23));
- }
- return $result;
- }
- }