Exemplo n.º 1
0
    /**
     * Display all available cron tasks
     * @param array array of cron objects
     * @param object page navigation
     * @param array lists
     */
    function show($rows, $pageNav, $lists)
    {
        FabrikViewCron::setCronsToolbar();
        $user =& JFactory::getUser();
        if (!JPluginHelper::isEnabled('system', 'fabrikcron')) {
            JError::raiseNotice(500, JText::_('CRON_PLUGIN_NOT_INSTALLED'));
            return;
        }
        ?>
		<form action="index.php" method="post" name="adminForm">
		<table class="adminlist">
			<thead>
			<tr>
				<th width="2%"><?php 
        echo JHTML::_('grid.sort', '#', 'g.id', @$lists['order_Dir'], @$lists['order']);
        ?>
</th>
				<th width="1%"> <input type="checkbox" name="toggle" value="" onclick="checkAll(<?php 
        echo count($rows);
        ?>
);" /> </th>
				<th width="35%">
					<?php 
        echo JHTML::_('grid.sort', 'Label', 'label', @$lists['order_Dir'], @$lists['order']);
        ?>
				</th>
				<th width="5%">
				<?php 
        echo JHTML::_('grid.sort', 'Published', 'g.state', @$lists['order_Dir'], @$lists['order']);
        ?>
				</th>
			</tr>
			</thead>
			<tfoot>
			<tr>
				<td colspan="6">
					<?php 
        echo $pageNav->getListFooter();
        ?>
				</td>
				</tr>
			</tfoot>
			<tbody>
			<?php 
        $k = 0;
        for ($i = 0, $n = count($rows); $i < $n; $i++) {
            $row =& $rows[$i];
            $checked = JHTML::_('grid.checkedout', $row, $i);
            $link = JRoute::_('index.php?option=com_fabrik&c=cron&task=edit&cid=' . $row->id);
            $row->published = $row->state;
            $published = JHTML::_('grid.published', $row, $i);
            ?>
				<tr class="<?php 
            echo "row{$k}";
            ?>
">
					<td width="2%"><?php 
            echo $row->id;
            ?>
</td>
					<td width="1%"><?php 
            echo $checked;
            ?>
</td>
					<td width="35%">
						<?php 
            if ($row->checked_out && $row->checked_out != $user->get('id')) {
                echo $row->label;
            } else {
                ?>
						<a href="<?php 
                echo $link;
                ?>
">
							<?php 
                echo $row->label;
                ?>
						</a>
					<?php 
            }
            ?>
					</td>
					<td width="5%">
						<?php 
            echo $published;
            ?>
					</td>
				</tr>
				<?php 
            $k = 1 - $k;
        }
        ?>
			</tbody>
		</table>
		<input type="hidden" name="option" value="com_fabrik" />
		<input type="hidden" name="c" value="cron" />
		<input type="hidden" name="task" value="" />
		<input type="hidden" name="boxchecked" value="0" />
		<input type="hidden" name="filter_order" value="<?php 
        echo $lists['order'];
        ?>
" />
		<input type="hidden" name="filter_order_Dir" value="<?php 
        echo $lists['order_Dir'];
        ?>
" />
		<?php 
        echo JHTML::_('form.token');
        ?>
	</form>
	<?php 
    }
Exemplo n.º 2
0
 /**
  * Display the list of cron jobs
  */
 function display()
 {
     $app =& JFactory::getApplication();
     $db =& JFactory::getDBO();
     //check if the cron plugin is installed
     $version = new JVersion();
     if ($version->RELEASE == '1.6') {
         $db->setQuery("SELECT count(extension_id) AS id FROM #__extensions WHERE folder = 'system' AND element = 'fabrikcron'");
     } else {
         $db->setQuery("SELECT count(id) FROM #__plugins WHERE folder = 'system' AND element = 'fabrikcron'");
     }
     $res = $db->loadResult();
     if ($res === 0) {
         return JError::raiseWarning(500, 'You must have the fabrik cron system plugin installed for this to work');
     }
     $user =& JFactory::getUser();
     $context = 'com_fabrik.cron.list.';
     $limit = $app->getUserStateFromRequest($context . 'limit', 'limit', $app->getCfg('list_limit'), 'int');
     $limitstart = $app->getUserStateFromRequest($context . 'limitstart', 'limitstart', 0, 'int');
     $filter_order = $app->getUserStateFromRequest($context . 'filter_order', 'filter_order', 'label', 'cmd');
     $filter_order_Dir = $app->getUserStateFromRequest($context . 'filter_order_Dir', 'filter_order_Dir', '', 'word');
     $lists = array();
     $where = array();
     $where = count($where) ? ' WHERE ' . implode(' AND ', $where) : '';
     $orderby = ' ORDER BY ' . $filter_order . ' ' . $filter_order_Dir;
     // get the total number of records
     $db->setQuery("SELECT COUNT(id) FROM #__fabrik_cron " . $where);
     $total = $db->loadResult();
     jimport('joomla.html.pagination');
     $pageNav = new JPagination($total, $limitstart, $limit);
     $sql = "SELECT *, u.name AS editor, c.id AS id FROM #__fabrik_cron AS c " . "\n LEFT JOIN #__users AS u ON u.id = c.checked_out" . "\n {$where} {$orderby}";
     $db->setQuery($sql, $pageNav->limitstart, $pageNav->limit);
     $rows = $db->loadObjectList();
     $arElcount = array();
     // table ordering
     $lists['order_Dir'] = $filter_order_Dir;
     $lists['order'] = $filter_order;
     require_once JPATH_COMPONENT . DS . 'views' . DS . 'cron.php';
     FabrikViewCron::show($rows, $pageNav, $lists);
 }