Source for file content.class.php
Documentation is available at content.class.php
* @author Mambo Foundation Inc see README.php
* @copyright Mambo Foundation Inc.
* See COPYRIGHT.php for copyright notices and details.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see
* Mambo is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; version 2 of the
* Category database table class
/** @var int Primary key */
/** @var string The menu title for the Category (a short name)*/
/** @var string The full name for the Category*/
* @param database A database connector object
$this->mosDBTable( '#__categories', 'id', $db );
// overloaded check function
$this->_error =
"Your Category must contain a title.";
$this->_error =
"Your Category must have a name.";
// check for existing name
$this->_db->setQuery( "SELECT id FROM #__categories "
.
"\nWHERE name='".
$this->name.
"' AND section='".
$this->section.
"'"
if ($xid &&
$xid !=
intval( $this->id )) {
$this->_error =
"There is a category already with that name, please try again.";
* Section database table class
/** @var int Primary key */
/** @var string The menu title for the Section (a short name)*/
/** @var string The full name for the Section*/
* @param database A database connector object
$this->mosDBTable( '#__sections', 'id', $db );
// overloaded check function
$this->_error =
"Your Section must contain a title.";
$this->_error =
"Your Section must have a name.";
// check for existing name
$this->_db->setQuery( "SELECT id FROM #__sections "
.
"\nWHERE name='$this->name' AND scope='$this->scope'"
if ($xid &&
$xid !=
intval( $this->id )) {
$this->_error =
"There is a section already with that name, please try again.";
* Module database table class
/** @var int Primary key */
/** @var int The id of the category section*/
/** @var int DEPRECATED */
/** @var string An alias for the author*/
* @param database A database connector object
$this->mosDBTable( '#__content', 'id', $db );
* Validation and filtering
$ignoreList =
array( 'introtext', 'fulltext' );
TODO: This filter is too rigorous,
need to implement more configurable solution
$iFilter = new InputFilter( null, null, 1, 1 );
$this->introtext = trim( $iFilter->process( $this->introtext ) );
$this->fulltext = trim( $iFilter->process( $this->fulltext ) );
* @param boolean Map foreign keys to text values
function toXML( $mapKeysToText=
false ) {
$query =
'SELECT name FROM #__sections WHERE id=' .
$this->sectionid;
$database->setQuery( $query );
$query =
'SELECT name FROM #__categories WHERE id=' .
$this->catid;
$database->setQuery( $query );
$this->catid =
$database->loadResult();
$query =
'SELECT name FROM #__users WHERE id=' .
$this->created_by;
$database->setQuery( $query );
return parent::toXML( $mapKeysToText );
* @return number of Published Blog Sections
if (count($menuhandler->getMenusByType('content_blog_section'))) {
$query =
"SELECT COUNT( m.id )"
.
"\n FROM #__content AS i"
.
"\n LEFT JOIN #__sections AS s ON i.sectionid=s.id"
.
"\n LEFT JOIN #__menu AS m ON m.componentid=s.id "
.
"\n WHERE m.type='content_blog_section'"
.
"\n AND m.published='1'"
$database->setQuery( $query );
$count =
$database->loadResult();
* @return number of Published Blog Categories
if (count($menuhandler->getMenusByType('content_blog_category'))) {
$query =
"SELECT COUNT( m.id )"
.
"\n FROM #__content AS i"
.
"\n LEFT JOIN #__categories AS c ON i.catid=c.id"
.
"\n LEFT JOIN #__menu AS m ON m.componentid=c.id "
.
"\n WHERE m.type='content_blog_category'"
.
"\n AND m.published='1'"
$database->setQuery( $query );
$count =
$database->loadResult();
* @return number of Published Global Blog Sections
return $menuhandler->getGlobalBlogSectionCount();
* @return number of Static Content
return $menuhandler->getMenuCount ('content_typed', 1);
* @return number of Content Item Links
return $menuhandler->getMenuCount ('content_item_link', 1);
function getItemid ($id, $typed=
1, $link=
1, $bs=
1, $bc=
1, $gbs=
1) {
$_Itemid =
$menuhandler->getIDByTypeLink('content_typed', "index.php?option=com_content&task=view&id=$id");
if ($_Itemid ==
null AND $link) {
$_Itemid =
$menuhandler->getIDByTypeLink('content_item_link', "index.php?option=com_content&task=view&id=$id");
$_Itemid =
$menuhandler->getIDByTypeCid ('content_section', $sectionid);
$_Itemid =
$menuhandler->getIDByTypeCid ('content_blog_section', $sectionid);
$_Itemid =
$menuhandler->getIDByTypeCid ('content_blog_category', $sectionid);
if ($_Itemid ==
null AND $gbs) {
// Search in global blog section
$_Itemid =
$menuhandler->getIDByTypeCid('content_blog_section', 0);
// Search in global blog category
$this->_db->setQuery( "SELECT id "
."\nWHERE type='content_blog_category' AND published='1' AND componentid=0" );
$_Itemid = $this->_db->loadResult();
// Search in blog categories
$_Itemid =
$menuhandler->getIDByTypeCid ('content_blog_category', $catid);
$_Itemid =
$menuhandler->getIDByTypeCid ('content_category', $catid);
$menus =
$menuhandler->getByParentOrder(0,'منوی اصلی');
if ($_Itemid) return $_Itemid;
$database->setQuery("SELECT i.id, i.sectionid FROM #__content AS i, #__sections AS s WHERE i.sectionid=s.id ORDER BY i.id DESC LIMIT $limit");
$sections =
$database->loadObjectList();
foreach ($sections as $section) $this->_sections[$section->id] =
$section->sectionid;
$database->setQuery("SELECT i.sectionid FROM #__content AS i, #__sections AS s WHERE i.sectionid=s.id AND i.id=$id");
return $database->loadResult();
$database->setQuery("SELECT i.id, i.catid FROM #__content AS i, #__categories AS s WHERE i.catid=s.id ORDER BY i.id DESC LIMIT $limit");
$categories =
$database->loadObjectList();
foreach ($categories as $category) $this->_categories[$category->id] =
$category->catid;
if (isset
($this->_categories[$id])) return $this->_categories[$id];
if (count($this->_categories) <
$limit) return 0;
$database->setQuery("SELECT i.catid FROM #__content AS i, #__categories AS s WHERE i.catid=s.id AND i.id=$id");
return $database->loadResult();
Documentation generated on Mon, 05 May 2008 16:18:19 +0400 by phpDocumentor 1.4.0