<?php
/**
 * @package     Joomla.Administrator
 * @subpackage  com_cpanel
 *
 * @copyright   Copyright (C) 2005 - 2015 Open Source Matters, Inc. All rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */

defined('_JEXEC') or die;

use Joomla\Registry\Registry;

$user = JFactory::getUser();

?>
<?php
$app =  JFactory::getApplication();
$template = $app->getTemplate();

						?>
<div class="row-fluid">
	<?php $iconmodules = JModuleHelper::getModules('icon');
	if ($iconmodules) : ?>
		<div class="span3">
			<div class="cpanel-links">
				<?php
				// Display the submenu position modules
				foreach ($iconmodules as $iconmodule)
				{
					echo JModuleHelper::renderModule($iconmodule);
				}
				?>
			</div>
		</div>
	<?php endif; ?>
 
    
	<div class="span<?php echo ($iconmodules) ? 9 : 12; ?>">
		<?php if ($user->authorise('core.manage', 'com_postinstall')) : ?>
		
        <div class="span3">
        	<div class="panelmo">
  				<div class="nonewsimg"></div>
                <div class="nonewstext">
                	<?php
						$db = JFactory::getDBO();
						$query = "SELECT COUNT(*) FROM #__content WHERE `state` = 1;";
						$db->setQuery($query);
						$count = $db->loadResult()
					 ?>
                     تعداد مطالب سایت :<?php echo ' '.$count . ' ' . 'عدد' ?>
                     </div>
                       <div class="nonewstext">
                     <?php $db = JFactory::getDBO();
						$query = "SELECT COUNT(*) FROM #__content WHERE `state` = 0;";
						$db->setQuery($query);
						$count = $db->loadResult() ?>
                       مطالب در انتظار تایید :<?php echo ' '.$count . ' ' . 'عدد' ?>
                </div>
                 <div class="clr"></div>
			</div>
        </div>
       
       
        <div class="span3">
        	<div class="panelmo">
  				<div class="dateimg"></div>
                <div class="nonewstext">
                	<?php
					$date = JFactory::getDate();
						$todayart = explode(' ',$date);
						$starttoday =$todayart[0] . ' 00:00:00';
						$endday = $todayart[0] . ' 23:59:59';
						$db = JFactory::getDBO();
						$query = "SELECT COUNT(*) FROM #__content WHERE `state` = 1 and `created` BETWEEN '".$starttoday."' AND '". $endday ."';";
						$db->setQuery($query);
						$count = $db->loadResult()
						
					 ?>
                     مطالب امروز :<?php echo ' '.$count . ' ' . 'عدد' ?>
                     </div>
                       <div class="nonewstext">
                     <?php $db = JFactory::getDBO();
						$query = "SELECT COUNT(*) FROM #__content WHERE `state` = 0 and `created` BETWEEN '".$starttoday."' AND '". $endday ."';";
						$db->setQuery($query);
						$count = $db->loadResult() ?>
                      در انتظار تایید امروز:<?php echo ' '.$count . ' ' . 'عدد' ?>
                </div>
                 <div class="clr"></div>
			</div>
        </div>
       
        <div class="span3">
        	<div class="panelmo1">
  					<div class="sendnews">
                    	<?php
						$image = $this->baseurl . '/templates/' . $template . '/images/sendnews.png';?>
                    <a href="index.php?option=com_content&view=article&layout=edit"><img src="<?php echo $image ?>" width="60" height="60" alt="ارسال خبر"/></a>
		                     </div>
                             <div class="gallery">
                          <?php    $image = $this->baseurl . '/templates/' . $template . '/images/gallery.png';?>
                    <a href="index.php?option=com_config"><img src="<?php echo $image ?>" width="60" height="60" alt="گالری تصاویر"/></a>
                             
                             </div>
                             <div class="comments">
                              <?php    $image = $this->baseurl . '/templates/' . $template . '/images/comments.png';?>
                    <a href="index.php?option=com_modules"><img src="<?php echo $image ?>" width="60" height="60" alt="نظرات"/></a>
                             
                             </div>
                     
                 <div class="clr"></div>
			</div>
        </div>
        <div class="span3">
        	<div class="panelmo2">
            	<div class="chaparresaneh" style="color:#FFF; padding:0 3px; line-height:21px ; font-size:10px">
                 <?php
				 $date = JFactory::getDate();
				 $user = JFactory::getUser();
				 echo $user->name. ' عزیز خوش آمدید'."<br />".'امروز : '.JHTML::_('date',"now","D d M Y")."<br />".'پشتیبانی توسط '."<a style='color:#FFF' href='http://neyshabur.ac.ir'>وحید دستجردی</a>"
				  ?>
                 
                </div>
            </div>
            </div>
       
       <div class="spacer"></div>
            <div class="row-fluid">
				<?php if ($this->postinstall_message_count): ?>
					
				<?php endif; ?>
			</div>
		<?php endif; ?>
		
        <div class="row-fluid">
        
			<?php
			$spans = 0;

			foreach ($this->modules as $module)
			{
				// Get module parameters
				$params = new Registry;
				$params->loadString($module->params);
				$bootstrapSize = $params->get('bootstrap_size');
				if (!$bootstrapSize)
				{
					$bootstrapSize = 12;
				}
				$spans += $bootstrapSize;
				if ($spans > 12)
				{
					echo '</div><div class="row-fluid">';
					$spans = $bootstrapSize;
				}
				echo JModuleHelper::renderModule($module, array('style' => 'well'));
			}
			?>
		</div>
	</div>
</div>
