You've already forked joomla_test
							
							first commit
This commit is contained in:
		
							
								
								
									
										129
									
								
								administrator/modules/mod_popular/helper.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										129
									
								
								administrator/modules/mod_popular/helper.php
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,129 @@ | ||||
| <?php | ||||
| /** | ||||
|  * @package     Joomla.Administrator | ||||
|  * @subpackage  mod_popular | ||||
|  * | ||||
|  * @copyright   Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved. | ||||
|  * @license     GNU General Public License version 2 or later; see LICENSE.txt | ||||
|  */ | ||||
|  | ||||
| defined('_JEXEC') or die; | ||||
|  | ||||
| JModelLegacy::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_content/models', 'ContentModel'); | ||||
|  | ||||
| /** | ||||
|  * Helper for mod_popular | ||||
|  * | ||||
|  * @package     Joomla.Administrator | ||||
|  * @subpackage  mod_popular | ||||
|  * @since       1.6 | ||||
|  */ | ||||
| abstract class ModPopularHelper | ||||
| { | ||||
| 	/** | ||||
| 	 * Get a list of the most popular articles | ||||
| 	 * | ||||
| 	 * @param   JObject  &$params  The module parameters. | ||||
| 	 * | ||||
| 	 * @return  array | ||||
| 	 */ | ||||
| 	public static function getList(&$params) | ||||
| 	{ | ||||
| 		$user = JFactory::getuser(); | ||||
|  | ||||
| 		// Get an instance of the generic articles model | ||||
| 		$model = JModelLegacy::getInstance('Articles', 'ContentModel', array('ignore_request' => true)); | ||||
|  | ||||
| 		// Set List SELECT | ||||
| 		$model->setState('list.select', 'a.id, a.title, a.checked_out, a.checked_out_time, ' . | ||||
| 				' a.created, a.hits'); | ||||
|  | ||||
| 		// Set Ordering filter | ||||
| 		$model->setState('list.ordering', 'a.hits'); | ||||
| 		$model->setState('list.direction', 'DESC'); | ||||
|  | ||||
| 		// Set Category Filter | ||||
| 		$categoryId = $params->get('catid'); | ||||
|  | ||||
| 		if (is_numeric($categoryId)) | ||||
| 		{ | ||||
| 			$model->setState('filter.category_id', $categoryId); | ||||
| 		} | ||||
|  | ||||
| 		// Set User Filter. | ||||
| 		$userId = $user->get('id'); | ||||
|  | ||||
| 		switch ($params->get('user_id')) | ||||
| 		{ | ||||
| 			case 'by_me': | ||||
| 				$model->setState('filter.author_id', $userId); | ||||
| 				break; | ||||
|  | ||||
| 			case 'not_me': | ||||
| 				$model->setState('filter.author_id', $userId); | ||||
| 				$model->setState('filter.author_id.include', false); | ||||
| 				break; | ||||
| 		} | ||||
|  | ||||
| 		// Set the Start and Limit | ||||
| 		$model->setState('list.start', 0); | ||||
| 		$model->setState('list.limit', $params->get('count', 5)); | ||||
|  | ||||
| 		$items = $model->getItems(); | ||||
|  | ||||
| 		if ($error = $model->getError()) | ||||
| 		{ | ||||
| 			JError::raiseError(500, $error); | ||||
|  | ||||
| 			return false; | ||||
| 		} | ||||
|  | ||||
| 		// Set the links | ||||
| 		foreach ($items as &$item) | ||||
| 		{ | ||||
| 			if ($user->authorise('core.edit', 'com_content.article.' . $item->id)) | ||||
| 			{ | ||||
| 				$item->link = JRoute::_('index.php?option=com_content&task=article.edit&id=' . $item->id); | ||||
| 			} | ||||
| 			else | ||||
| 			{ | ||||
| 				$item->link = ''; | ||||
| 			} | ||||
| 		} | ||||
|  | ||||
| 		return $items; | ||||
| 	} | ||||
|  | ||||
| 	/** | ||||
| 	 * Get the alternate title for the module | ||||
| 	 * | ||||
| 	 * @param   JObject  $params  The module parameters. | ||||
| 	 * | ||||
| 	 * @return  string	The alternate title for the module. | ||||
| 	 */ | ||||
| 	public static function getTitle($params) | ||||
| 	{ | ||||
| 		$who = $params->get('user_id'); | ||||
| 		$catid = (int) $params->get('catid'); | ||||
|  | ||||
| 		if ($catid) | ||||
| 		{ | ||||
| 			$category = JCategories::getInstance('Content')->get($catid); | ||||
|  | ||||
| 			if ($category) | ||||
| 			{ | ||||
| 				$title = $category->title; | ||||
| 			} | ||||
| 			else | ||||
| 			{ | ||||
| 				$title = JText::_('MOD_POPULAR_UNEXISTING'); | ||||
| 			} | ||||
| 		} | ||||
| 		else | ||||
| 		{ | ||||
| 			$title = ''; | ||||
| 		} | ||||
|  | ||||
| 		return JText::plural('MOD_POPULAR_TITLE' . ($catid ? "_CATEGORY" : '') . ($who != '0' ? "_$who" : ''), (int) $params->get('count'), $title); | ||||
| 	} | ||||
| } | ||||
							
								
								
									
										1
									
								
								administrator/modules/mod_popular/index.html
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								administrator/modules/mod_popular/index.html
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1 @@ | ||||
| <!DOCTYPE html><title></title> | ||||
							
								
								
									
										19
									
								
								administrator/modules/mod_popular/mod_popular.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										19
									
								
								administrator/modules/mod_popular/mod_popular.php
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,19 @@ | ||||
| <?php | ||||
| /** | ||||
|  * @package     Joomla.Administrator | ||||
|  * @subpackage  mod_popular | ||||
|  * | ||||
|  * @copyright   Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved. | ||||
|  * @license     GNU General Public License version 2 or later; see LICENSE.txt | ||||
|  */ | ||||
|  | ||||
| defined('_JEXEC') or die; | ||||
|  | ||||
| // Include the mod_popular functions only once. | ||||
| require_once __DIR__ . '/helper.php'; | ||||
|  | ||||
| // Get module data. | ||||
| $list = ModPopularHelper::getList($params); | ||||
|  | ||||
| // Render the module | ||||
| require JModuleHelper::getLayoutPath('mod_popular', $params->get('layout', 'default')); | ||||
							
								
								
									
										100
									
								
								administrator/modules/mod_popular/mod_popular.xml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										100
									
								
								administrator/modules/mod_popular/mod_popular.xml
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,100 @@ | ||||
| <?xml version="1.0" encoding="utf-8"?> | ||||
| <extension | ||||
| 	type="module" | ||||
| 	version="3.1" | ||||
| 	client="administrator"> | ||||
| 	<name>mod_popular</name> | ||||
| 	<author>Joomla! Project</author> | ||||
| 	<creationDate>July 2004</creationDate> | ||||
| 	<copyright>Copyright (C) 2005 - 2013 Open Source Matters. All rights reserved.</copyright> | ||||
| 	<license>GNU General Public License version 2 or later; see LICENSE.txt</license> | ||||
| 	<authorEmail>admin@joomla.org</authorEmail> | ||||
| 	<authorUrl>www.joomla.org</authorUrl> | ||||
| 	<version>3.0.0</version> | ||||
| 	<description>MOD_POPULAR_XML_DESCRIPTION</description> | ||||
| 	<files> | ||||
| 		<filename module="mod_popular">mod_popular.php</filename> | ||||
| 		<filename>helper.php</filename> | ||||
| 		<filename>index.html</filename> | ||||
| 		<folder>tmpl</folder> | ||||
| 	</files> | ||||
| 	<languages> | ||||
| 		<language tag="en-GB">en-GB.mod_popular.ini</language> | ||||
| 		<language tag="en-GB">en-GB.mod_popular.sys.ini</language> | ||||
| 	</languages> | ||||
| 	<help key="JHELP_EXTENSIONS_MODULE_MANAGER_ADMIN_POPULAR" /> | ||||
| 	<config> | ||||
| 		<fields name="params"> | ||||
| 			<fieldset name="basic"> | ||||
| 				<field | ||||
| 					name="count" | ||||
| 					type="text" | ||||
| 					default="5" | ||||
| 					label="MOD_POPULAR_FIELD_COUNT_LABEL" | ||||
| 					description="MOD_POPULAR_FIELD_COUNT_DESC" /> | ||||
| 				<field | ||||
| 					id="catid" | ||||
| 					name="catid" | ||||
| 					type="category" | ||||
| 					extension="com_content" | ||||
| 					label="JCATEGORY" | ||||
| 					description="MOD_POPULAR_FIELD_CATEGORY_DESC" | ||||
| 					default="" | ||||
| 					class="inputbox"> | ||||
| 					<option | ||||
| 						value="">JOPTION_ANY_CATEGORY</option> | ||||
| 				</field> | ||||
| 				<field | ||||
| 					name="user_id" | ||||
| 					type="list" | ||||
| 					default="0" | ||||
| 					label="MOD_POPULAR_FIELD_AUTHORS_LABEL" | ||||
| 					description="MOD_POPULAR_FIELD_AUTHORS_DESC"> | ||||
| 					<option | ||||
| 						value="0">MOD_POPULAR_FIELD_VALUE_ANYONE</option> | ||||
| 					<option | ||||
| 						value="by_me">MOD_POPULAR_FIELD_VALUE_ADDED_OR_MODIFIED_BY_ME</option> | ||||
| 					<option | ||||
| 						value="not_me">MOD_POPULAR_FIELD_VALUE_NOT_ADDED_OR_MODIFIED_BY_ME</option> | ||||
| 				</field> | ||||
| 			</fieldset> | ||||
| 			<fieldset | ||||
| 				name="advanced"> | ||||
| 				<field | ||||
| 					name="layout" | ||||
| 					type="modulelayout" | ||||
| 					label="JFIELD_ALT_LAYOUT_LABEL" | ||||
| 					description="JFIELD_ALT_MODULE_LAYOUT_DESC" /> | ||||
|  | ||||
| 				<field | ||||
| 					name="moduleclass_sfx" | ||||
| 					type="textarea" rows="3" | ||||
| 					label="COM_MODULES_FIELD_MODULECLASS_SFX_LABEL" | ||||
| 					description="COM_MODULES_FIELD_MODULECLASS_SFX_DESC" /> | ||||
|  | ||||
| 				<field | ||||
| 					name="cache" | ||||
| 					type="list" | ||||
| 					default="0" | ||||
| 					label="COM_MODULES_FIELD_CACHING_LABEL" | ||||
| 					description="COM_MODULES_FIELD_CACHING_DESC"> | ||||
| 					<option | ||||
| 						value="0">COM_MODULES_FIELD_VALUE_NOCACHING</option> | ||||
| 				</field> | ||||
|  | ||||
| 				<field | ||||
| 					name="automatic_title" | ||||
| 					type="radio" | ||||
| 					class="btn-group" | ||||
| 					default="0" | ||||
| 					label="COM_MODULES_FIELD_AUTOMATIC_TITLE_LABEL" | ||||
| 					description="COM_MODULES_FIELD_AUTOMATIC_TITLE_DESC"> | ||||
| 					<option | ||||
| 						value="0">JNO</option> | ||||
| 					<option | ||||
| 						value="1">JYES</option> | ||||
| 				</field> | ||||
| 			</fieldset> | ||||
| 		</fields> | ||||
| 	</config> | ||||
| </extension> | ||||
							
								
								
									
										49
									
								
								administrator/modules/mod_popular/tmpl/default.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										49
									
								
								administrator/modules/mod_popular/tmpl/default.php
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,49 @@ | ||||
| <?php | ||||
| /** | ||||
|  * @package     Joomla.Administrator | ||||
|  * @subpackage  mod_popular | ||||
|  * | ||||
|  * @copyright   Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved. | ||||
|  * @license     GNU General Public License version 2 or later; see LICENSE.txt | ||||
|  */ | ||||
|  | ||||
| defined('_JEXEC') or die; | ||||
|  | ||||
| JHtml::_('bootstrap.tooltip'); | ||||
| ?> | ||||
| <div class="row-striped"> | ||||
| 	<?php if (count($list)) : ?> | ||||
| 		<?php foreach ($list as $i => $item) : | ||||
| 			// Calculate popular items | ||||
| 			$hits = (int) $item->hits; | ||||
| 			$hits_class = $hits >= 100 ? 'important' : $hits >= 25 ? 'warning' : $hits >= 10 ? 'info' : ''; | ||||
| 		?> | ||||
| 			<div class="row-fluid"> | ||||
| 				<div class="span9"> | ||||
| 					<span class="badge badge-<?php echo $hits_class;?> hasTooltip" title="<?php echo JHtml::tooltipText('JGLOBAL_HITS');?>"><?php echo $item->hits;?></span> | ||||
| 					<?php if ($item->checked_out) : ?> | ||||
| 							<?php echo JHtml::_('jgrid.checkedout', $i, $item->editor, $item->checked_out_time); ?> | ||||
| 					<?php endif; ?> | ||||
|  | ||||
| 					<strong class="row-title"> | ||||
| 						<?php if ($item->link) :?> | ||||
| 							<a href="<?php echo $item->link; ?>"> | ||||
| 								<?php echo htmlspecialchars($item->title, ENT_QUOTES, 'UTF-8');?></a> | ||||
| 						<?php else : | ||||
| 							echo htmlspecialchars($item->title, ENT_QUOTES, 'UTF-8'); | ||||
| 						endif; ?> | ||||
| 					</strong> | ||||
| 				</div> | ||||
| 				<div class="span3"> | ||||
| 					<span class="small"><i class="icon-calendar"></i> <?php echo JHtml::_('date', $item->created, 'Y-m-d'); ?></span> | ||||
| 				</div> | ||||
| 			</div> | ||||
| 		<?php endforeach; ?> | ||||
| 	<?php else : ?> | ||||
| 		<div class="row-fluid"> | ||||
| 			<div class="span12"> | ||||
| 				<div class="alert"><?php echo JText::_('MOD_POPULAR_NO_MATCHING_RESULTS');?></div> | ||||
| 			</div> | ||||
| 		</div> | ||||
| 	<?php endif; ?> | ||||
| </div> | ||||
							
								
								
									
										1
									
								
								administrator/modules/mod_popular/tmpl/index.html
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								administrator/modules/mod_popular/tmpl/index.html
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1 @@ | ||||
| <!DOCTYPE html><title></title> | ||||
		Reference in New Issue
	
	Block a user
	 alazhar
					alazhar