本文整理汇总了PHP中RtiprintHelper类的典型用法代码示例。如果您正苦于以下问题:PHP RtiprintHelper类的具体用法?PHP RtiprintHelper怎么用?PHP RtiprintHelper使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了RtiprintHelper类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: displayPrinter
/**
* Execute and display a template : Printer
*
* @access protected
* @param string $tpl The name of the template file to parse; automatically searches through the template paths.
*
* @return mixed A string if successful, otherwise a JError object.
*
* @since 11.1
*/
protected function displayPrinter($tpl = null)
{
$document = JFactory::getDocument();
$this->title = JText::_("RTIPRINT_LAYOUT_PRINTER");
$document->title = $document->titlePrefix . $this->title . $document->titleSuffix;
// Initialiase variables.
$this->model = $model = $this->getModel();
$this->state = $state = $this->get('State');
$state->set('context', 'printer.printer');
$this->item = $item = $this->get('Item');
$this->canDo = $canDo = RtiprintHelper::getActions($model->getId());
$lists = array();
$this->lists =& $lists;
$user = JFactory::getUser();
$isNew = $model->getId() == 0;
//Check ACL before opening the view (prevent from direct access)
if (!$model->canAccess($item)) {
$model->setError(JText::_('JERROR_ALERTNOAUTHOR'));
}
// Check for errors.
if (count($errors = $model->getErrors())) {
JError::raiseError(500, implode(BR, array_unique($errors)));
return false;
}
$jinput = JFactory::getApplication()->input;
//Hide the component menu in item layout
$jinput->set('hidemainmenu', true);
//Toolbar initialization
// Cancel
CkJToolBarHelper::cancel('printer.cancel', "RTIPRINT_JTOOLBAR_CANCEL");
}
示例2: displayPrinter
/**
* Execute and display a template : Printer
*
* @access protected
* @param string $tpl The name of the template file to parse; automatically searches through the template paths.
*
* @return mixed A string if successful, otherwise a JError object.
*
* @since 11.1
*/
protected function displayPrinter($tpl = null)
{
$document = JFactory::getDocument();
$this->title = JText::_("RTIPRINT_LAYOUT_PRINTER");
$document->title = $document->titlePrefix . $this->title . $document->titleSuffix;
// Initialiase variables.
$this->model = $model = $this->getModel();
$this->state = $state = $this->get('State');
$state->set('context', 'printer.printer');
$this->item = $item = $this->get('Item');
$this->form = $form = $this->get('Form');
$this->canDo = $canDo = RtiprintHelper::getActions($model->getId());
$lists = array();
$this->lists =& $lists;
$user = JFactory::getUser();
$isNew = $model->getId() == 0;
//Check ACL before opening the form (prevent from direct access)
if (!$model->canEdit($item, true)) {
$model->setError(JText::_('JERROR_ALERTNOAUTHOR'));
}
// Check for errors.
if (count($errors = $model->getErrors())) {
JError::raiseError(500, implode(BR, array_unique($errors)));
return false;
}
$jinput = JFactory::getApplication()->input;
//Hide the component menu in item layout
$jinput->set('hidemainmenu', true);
//Toolbar initialization
JToolBarHelper::title(JText::_('RTIPRINT_LAYOUT_PRINTER'), 'rtiprint_printers');
// Save
if ($isNew && $model->canCreate() || !$isNew && $item->params->get('access-edit')) {
CkJToolBarHelper::apply('printer.apply', "RTIPRINT_JTOOLBAR_SAVE");
}
// Save & Close
if ($isNew && $model->canCreate() || !$isNew && $item->params->get('access-edit')) {
CkJToolBarHelper::save('printer.save', "RTIPRINT_JTOOLBAR_SAVE_CLOSE");
}
// Save & New
if ($isNew && $model->canCreate() || !$isNew && $item->params->get('access-edit')) {
CkJToolBarHelper::save2new('printer.save2new', "RTIPRINT_JTOOLBAR_SAVE_NEW");
}
// Save to Copy
if ($isNew && $model->canCreate() || !$isNew && $item->params->get('access-edit')) {
CkJToolBarHelper::save2copy('printer.save2copy', "RTIPRINT_JTOOLBAR_SAVE_TO_COPY");
}
// Cancel
CkJToolBarHelper::cancel('printer.cancel', "RTIPRINT_JTOOLBAR_CANCEL");
// Delete
if (!$isNew && $item->params->get('access-delete')) {
JToolbar::getInstance('toolbar')->appendButton('Confirm', JText::_('RTIPRINT_JTOOLBAR_ARE_YOU_SURE_TO_DELETE'), 'delete', "RTIPRINT_JTOOLBAR_DELETE", 'printer.delete', false);
}
$model_printer_model = CkJModel::getInstance('Printermdls', 'RtiprintModel');
$model_printer_model->addGroupOrder("a.name");
$lists['fk']['printer_model'] = $model_printer_model->getItems();
$model_server = CkJModel::getInstance('Servers', 'RtiprintModel');
$model_server->addGroupOrder("a.name");
$lists['fk']['server'] = $model_server->getItems();
}
示例3: displayDefault
/**
* Execute and display a template : RT iPrint
*
* @access protected
* @param string $tpl The name of the template file to parse; automatically searches through the template paths.
*
* @return mixed A string if successful, otherwise a JError object.
*
* @since 11.1
*/
protected function displayDefault($tpl = null)
{
$document = JFactory::getDocument();
$this->title = JText::_("RTIPRINT_LAYOUT_RT_IPRINT");
$document->title = $document->titlePrefix . $this->title . $document->titleSuffix;
$this->menu = RtiprintHelper::addSubmenu('cpanel', 'default', 'cpanel');
//Toolbar initialization
}
示例4: display
/**
* Method to display a view.
*
* @access public
* @param boolean $cachable If true, the view output will be cached.
* @param array $urlparams An array of safe url parameters and their variable types, for valid values see {@link JFilterInput::clean()}..
* @return void
*
* @since Cook 1.0
*/
public function display($cachable = false, $urlparams = false)
{
$jinput = JFactory::getApplication()->input;
$this->_parentDisplay();
//If page is called through POST, reconstruct the url
if ($jinput->getMethod(null, null) == 'POST') {
//Kill the post and rebuild the url
$this->setRedirect(RtiprintHelper::urlRequest());
return;
}
return $this;
}
示例5: displayTown
/**
* Execute and display a template : Town
*
* @access protected
* @param string $tpl The name of the template file to parse; automatically searches through the template paths.
*
* @return mixed A string if successful, otherwise a JError object.
*
* @since 11.1
*/
protected function displayTown($tpl = null)
{
$document = JFactory::getDocument();
$this->title = JText::_("RTIPRINT_LAYOUT_TOWN");
$document->title = $document->titlePrefix . $this->title . $document->titleSuffix;
// Initialiase variables.
$this->model = $model = $this->getModel();
$this->state = $state = $this->get('State');
$state->set('context', 'town.town');
$this->item = $item = $this->get('Item');
$this->form = $form = $this->get('Form');
$this->canDo = $canDo = RtiprintHelper::getActions($model->getId());
$lists = array();
$this->lists =& $lists;
$user = JFactory::getUser();
$isNew = $model->getId() == 0;
//Check ACL before opening the form (prevent from direct access)
if (!$model->canEdit($item, true)) {
$model->setError(JText::_('JERROR_ALERTNOAUTHOR'));
}
// Check for errors.
if (count($errors = $model->getErrors())) {
JError::raiseError(500, implode(BR, array_unique($errors)));
return false;
}
$jinput = JFactory::getApplication()->input;
//Hide the component menu in item layout
$jinput->set('hidemainmenu', true);
//Toolbar initialization
JToolBarHelper::title(JText::_('RTIPRINT_LAYOUT_TOWN'), 'rtiprint_towns');
// Preview
CkJToolBarHelper::preview('index.php?option=com_rtiprint&view=town&layout=town&tmpl=component&cid=' . $model->getState('town.id'));
// Save
if ($isNew && $model->canCreate() || !$isNew && $item->params->get('access-edit')) {
CkJToolBarHelper::apply('town.apply', "RTIPRINT_JTOOLBAR_SAVE");
}
// Save & Close
if ($isNew && $model->canCreate() || !$isNew && $item->params->get('access-edit')) {
CkJToolBarHelper::save('town.save', "RTIPRINT_JTOOLBAR_SAVE_CLOSE");
}
// Save & New
if ($isNew && $model->canCreate() || !$isNew && $item->params->get('access-edit')) {
CkJToolBarHelper::save2new('town.save2new', "RTIPRINT_JTOOLBAR_SAVE_NEW");
}
// Save to Copy
if ($isNew && $model->canCreate() || !$isNew && $item->params->get('access-edit')) {
CkJToolBarHelper::save2copy('town.save2copy', "RTIPRINT_JTOOLBAR_SAVE_TO_COPY");
}
// Cancel
CkJToolBarHelper::cancel('town.cancel', "RTIPRINT_JTOOLBAR_CANCEL");
}
示例6: canView
/**
* Method to check the authorisations.
*
* @access public
*
* @return boolean True if user is allowed to see the field.
*/
public function canView()
{
if (!isset($this->element['access'])) {
return true;
}
$access = (string) $this->element['access'];
$acl = RtiprintHelper::getActions();
foreach (explode(",", $access) as $action) {
if ($acl->get($action)) {
return true;
}
}
return false;
}
示例7: populateState
public function populateState($ordering = null, $direction = null)
{
// Initialise variables.
$app = JFactory::getApplication();
$session = JFactory::getSession();
$acl = RtiprintHelper::getActions();
parent::populateState('a.ordering', 'asc');
//Only show the published items
if (!$acl->get('core.admin') && !$acl->get('core.edit.state')) {
$this->setState('filter.published', 1);
}
$this->setState('list.limit', 0);
$this->setState('list.ordering', 'a.town');
$this->setState('list.direction', 'ASC');
}
示例8: prepareQuery
/**
* Preparation of the query.
*
* @access protected
* @param object &$query returns a filled query object.
* @param integer $pk The primary id key of the printer
* @return void
*/
protected function prepareQuery(&$query, $pk)
{
$acl = RtiprintHelper::getActions();
//FROM : Main table
$query->from('#__rtiprint_printers AS a');
//IMPORTANT REQUIRED FIELDS
$this->addSelect('a.id,' . 'a.created_by,' . 'a.published');
switch ($this->getState('context', 'all')) {
case 'printer.printer':
//BASE FIELDS
$this->addSelect('a.ip_address,' . 'a.location,' . 'a.name,' . 'a.printer_model,' . 'a.server');
//SELECT
$this->addSelect('_printer_model_.name AS `_printer_model_name`');
$this->addSelect('_printer_model_.asset_code AS `_printer_model_asset_code`');
$this->addSelect('_printer_model_.manual AS `_printer_model_manual`');
$this->addSelect('_printer_model_.manufacturer AS `_printer_model_manufacturer`');
$this->addSelect('_printer_model_manufacturer_.name AS `_printer_model_manufacturer_name`');
$this->addSelect('_printer_model_.image AS `_printer_model_image`');
$this->addSelect('_server_.name AS `_server_name`');
$this->addSelect('_server_.ip_address AS `_server_ip_address`');
//JOIN
$this->addJoin('`#__rtiprint_printermdls` AS _printer_model_ ON _printer_model_.id = a.printer_model', 'LEFT');
$this->addJoin('`#__rtiprint_manufacturers` AS _printer_model_manufacturer_ ON _printer_model_manufacturer_.id = _printer_model_.manufacturer', 'LEFT');
$this->addJoin('`#__rtiprint_servers` AS _server_ ON _server_.id = a.server', 'LEFT');
break;
case 'all':
//SELECT : raw complete query without joins
$query->select('a.*');
break;
}
//WHERE : Item layout (based on $pk)
$query->where('a.id = ' . (int) $pk);
//TABLE KEY
//FILTER - Access for : Root table
$wherePublished = $allowAuthor = true;
$whereAccess = false;
$this->prepareQueryAccess('a', $whereAccess, $wherePublished, $allowAuthor);
$query->where("({$allowAuthor} OR {$wherePublished})");
//SELECT : Instance Add-ons
foreach ($this->getState('query.select', array()) as $select) {
$query->select($select);
}
//JOIN : Instance Add-ons
foreach ($this->getState('query.join.left', array()) as $join) {
$query->join('LEFT', $join);
}
}
示例9: displayModal
/**
* Execute and display a template : Contents
*
* @access protected
* @param string $tpl The name of the template file to parse; automatically searches through the template paths.
*
* @return mixed A string if successful, otherwise a JError object.
*
* @since 11.1
*/
protected function displayModal($tpl = null)
{
$document = JFactory::getDocument();
$this->title = JText::_("RTIPRINT_LAYOUT_CONTENTS");
$document->title = $document->titlePrefix . $this->title . $document->titleSuffix;
$this->model = $model = $this->getModel();
$this->state = $state = $this->get('State');
$state->set('context', 'thirdcontents.modal');
$this->items = $items = $this->get('Items');
$this->canDo = $canDo = RtiprintHelper::getActions();
$this->pagination = $this->get('Pagination');
$this->menu = RtiprintHelper::addSubmenu('contents', 'modal');
$lists = array();
$this->lists =& $lists;
//Toolbar initialization
JToolBarHelper::title(JText::_('RTIPRINT_LAYOUT_CONTENTS'), 'rtiprint_contents');
}
示例10: displayDefault
/**
* Execute and display a template : ControlPanel
*
* @access protected
* @param string $tpl The name of the template file to parse; automatically searches through the template paths.
*
* @return mixed A string if successful, otherwise a JError object.
*
* @since 11.1
*/
protected function displayDefault($tpl = null)
{
$document = JFactory::getDocument();
$this->title = JText::_("RTIPRINT_LAYOUT_CONTROLPANEL");
$document->title = $document->titlePrefix . $this->title . $document->titleSuffix;
$this->model = $model = $this->getModel();
$this->state = $state = $this->get('State');
$state->set('context', 'changelogs.default');
$this->items = $items = $this->get('Items');
$this->canDo = $canDo = RtiprintHelper::getActions();
$this->pagination = $this->get('Pagination');
$this->menu = RtiprintHelper::addSubmenu('changelogs', 'default');
$this->mainmenu = RtiprintHelper::addSubmenu('changelogs', 'default', 'mainmenu');
$this->geographymenu = RtiprintHelper::addSubmenu('changelogs', 'default', 'geographymenu');
$this->systemmenu = RtiprintHelper::addSubmenu('changelogs', 'default', 'systemmenu');
$lists = array();
$this->lists =& $lists;
//Toolbar initialization
JToolBarHelper::title(JText::_('RTIPRINT_LAYOUT_CONTROLPANEL'), 'rtiprint_changelogs');
// Config
if ($model->canAdmin()) {
CkJToolBarHelper::preferences('com_rtiprint');
}
}
示例11: prepareQuery
/**
* Preparation of the list query.
*
* @access protected
* @param object &$query returns a filled query object.
* @return void
*/
protected function prepareQuery(&$query)
{
$acl = RtiprintHelper::getActions();
//FROM : Main table
$query->from('#__rtiprint_operatingsystems AS a');
//IMPORTANT REQUIRED FIELDS
$this->addSelect('a.id,' . 'a.created_by,' . 'a.published');
switch ($this->getState('context', 'all')) {
case 'operatingsystems.default':
//BASE FIELDS
$this->addSelect('a.creation_date,' . 'a.modification_date,' . 'a.name,' . 'a.ordering');
//SELECT
$this->addSelect('_created_by_.name AS `_created_by_name`');
//JOIN
$this->addJoin('`#__users` AS _created_by_ ON _created_by_.id = a.created_by', 'LEFT');
break;
case 'operatingsystems.modal':
//BASE FIELDS
$this->addSelect('a.name');
break;
case 'all':
//SELECT : raw complete query without joins
$this->addSelect('a.*');
// Disable the pagination
$this->setState('list.limit', null);
$this->setState('list.start', null);
break;
}
//FILTER - Access for : Root table
$wherePublished = $allowAuthor = true;
$whereAccess = false;
$this->prepareQueryAccess('a', $whereAccess, $wherePublished, $allowAuthor);
$query->where("({$allowAuthor} OR {$wherePublished})");
//WHERE - SEARCH : search_search : search on Name
$search_search = $this->getState('search.search');
$this->addSearch('search', 'a.name', 'like');
if ($search_search != '' && ($search_search_val = $this->buildSearch('search', $search_search))) {
$this->addWhere($search_search_val);
}
//WHERE - FILTER : Publish state
$published = $this->getState('filter.published');
if (is_numeric($published)) {
$allowAuthor = '';
if ($published == 1 && !$acl->get('core.edit.state')) {
//Allow the author to see its own unpublished/archived/trashed items
if ($acl->get('core.edit.own') || $acl->get('core.view.own')) {
$allowAuthor = ' OR a.created_by = ' . (int) JFactory::getUser()->get('id');
}
}
$query->where('(a.published = ' . (int) $published . $allowAuthor . ')');
} elseif (!$published) {
$query->where('(a.published = 0 OR a.published = 1 OR a.published IS NULL)');
}
//WHERE - SEARCH : search_search_1 : search on Name
$search_search_1 = $this->getState('search.search_1');
$this->addSearch('search_1', 'a.name', 'like');
if ($search_search_1 != '' && ($search_search_1_val = $this->buildSearch('search_1', $search_search_1))) {
$this->addWhere($search_search_1_val);
}
//Populate only uniques strings to the query
//SELECT
foreach ($this->getState('query.select', array()) as $select) {
$query->select($select);
}
//JOIN
foreach ($this->getState('query.join.left', array()) as $join) {
$query->join('LEFT', $join);
}
//WHERE
foreach ($this->getState('query.where', array()) as $where) {
$query->where($where);
}
//GROUP ORDER : Prioritary order for groups in lists
foreach ($this->getState('query.groupOrder', array()) as $groupOrder) {
$query->order($groupOrder);
}
//ORDER
foreach ($this->getState('query.order', array()) as $order) {
$query->order($order);
}
//ORDER
$orderCol = $this->getState('list.ordering');
$orderDir = $this->getState('list.direction', 'asc');
if ($orderCol) {
$query->order($orderCol . ' ' . $orderDir);
}
}
示例12: displayModal
/**
* Execute and display a template : PrinterModels
*
* @access protected
* @param string $tpl The name of the template file to parse; automatically searches through the template paths.
*
* @return mixed A string if successful, otherwise a JError object.
*
* @since 11.1
*/
protected function displayModal($tpl = null)
{
$document = JFactory::getDocument();
$this->title = JText::_("RTIPRINT_LAYOUT_PRINTERMODELS");
$document->title = $document->titlePrefix . $this->title . $document->titleSuffix;
$this->model = $model = $this->getModel();
$this->state = $state = $this->get('State');
$state->set('context', 'printermdls.modal');
$this->items = $items = $this->get('Items');
$this->canDo = $canDo = RtiprintHelper::getActions();
$this->pagination = $this->get('Pagination');
$this->filters = $filters = $model->getForm('modal.filters');
$this->menu = RtiprintHelper::addSubmenu('printermdls', 'modal');
$lists = array();
$this->lists =& $lists;
//Filters
// Manufacturer
$modelManufacturer = CkJModel::getInstance('manufacturers', 'RtiprintModel');
$filters['filter_manufacturer']->jdomOptions = array('list' => $modelManufacturer->getItems());
// Limit
$filters['limit']->jdomOptions = array('pagination' => $this->pagination);
//Toolbar initialization
}
示例13: prepareQueryAccess
/**
* Prepare the query for filtering accesses. Can be used on foreign keys.
*
* @access protected
* @param varchar $table The table alias (_tablealias_).
* @param varchar &$whereAccess The returned SQL access filter. Set to true to activate it.
* @param varchar &$wherePublished The returned SQL published filter. Set to true to activate it.
* @param varchar &$allowAuthor The returned SQL to allow author to pass. Set to true to activate it.
* @return void
*/
protected function prepareQueryAccess($table = 'a', &$whereAccess = null, &$wherePublished = null, &$allowAuthor = null)
{
$acl = RtiprintHelper::getActions();
// Must be aliased ex : _tablename_
if ($table != 'a') {
$table = '_' . trim($table, '_') . '_';
}
// ACCESS - View Level Access
if ($whereAccess) {
// Select fields requirements
if ($table != 'a') {
$this->addSelect($table . '.access AS `' . $table . 'access`');
}
$whereAccess = '1';
if (!$this->canAdmin()) {
$groups = implode(',', JFactory::getUser()->getAuthorisedViewLevels());
$whereAccess = $table . '.access IN (' . $groups . ')';
}
}
// ACCESS - Author
if ($allowAuthor) {
// Select fields requirements
if ($table != 'a') {
$this->addSelect($table . '.created_by AS `' . $table . 'created_by`');
}
$allowAuthor = '0';
//Allow the author to see its own unpublished/archived/trashed items
if ($acl->get('core.edit.own') || $acl->get('core.view.own') || $acl->get('core.delete.own')) {
$allowAuthor = $table . '.created_by = ' . (int) JFactory::getUser()->get('id');
}
}
// ACCESS - Publish state
if ($wherePublished) {
// Select fields requirements
if ($table != 'a') {
$this->addSelect($table . '.published AS `' . $table . 'published`');
}
$wherePublished = '(' . $table . '.published = 1 OR ' . $table . '.published IS NULL)';
//Published or undefined state
//Allow some users to access (core.edit.state)
if ($acl->get('core.edit.state')) {
$wherePublished = '1';
}
//Do not filter
// FILTER - Published state
$published = $this->getState('filter.published');
//Only apply filter on current table. Aand only if ACL permits.
if ($table == 'a' && is_numeric($published) && $acl->get('core.edit.state')) {
//Limit to publish state when filter is applied
$wherePublished = $table . '.published = ' . (int) $published;
//Does not apply the author condition when filter is defined
$allowAuthor = '0';
}
}
// Fallback values
if (!$whereAccess) {
$whereAccess = '1';
}
if (!$allowAuthor) {
$allowAuthor = '0';
}
if (!$wherePublished) {
$wherePublished = '1';
}
}
示例14: getMarkers
/**
* Deprecated. see Helper::getDirectories()
*
* @access public static
*
* @return array Directories shortcuts.
*
* @since Cook 1.1
*/
public static function getMarkers()
{
return RtiprintHelper::getDirectories();
}
示例15: prepareQuery
/**
* Preparation of the list query.
*
* @access protected
* @param object &$query returns a filled query object.
* @return void
*/
protected function prepareQuery(&$query)
{
$acl = RtiprintHelper::getActions();
//FROM : Main table
$query->from('#__rtiprint_changelogs AS a');
//IMPORTANT REQUIRED FIELDS
$this->addSelect('a.id,' . 'a.created_by,' . 'a.published');
switch ($this->getState('context', 'all')) {
case 'changelogs.default':
//BASE FIELDS
$this->addSelect('a.creation_date,' . 'a.summary,' . 'a.version');
break;
case 'all':
//SELECT : raw complete query without joins
$this->addSelect('a.*');
// Disable the pagination
$this->setState('list.limit', null);
$this->setState('list.start', null);
break;
}
//FILTER - Access for : Root table
$wherePublished = $allowAuthor = true;
$whereAccess = false;
$this->prepareQueryAccess('a', $whereAccess, $wherePublished, $allowAuthor);
$query->where("({$allowAuthor} OR {$wherePublished})");
//Populate only uniques strings to the query
//SELECT
foreach ($this->getState('query.select', array()) as $select) {
$query->select($select);
}
//JOIN
foreach ($this->getState('query.join.left', array()) as $join) {
$query->join('LEFT', $join);
}
//WHERE
foreach ($this->getState('query.where', array()) as $where) {
$query->where($where);
}
//GROUP ORDER : Prioritary order for groups in lists
foreach ($this->getState('query.groupOrder', array()) as $groupOrder) {
$query->order($groupOrder);
}
//ORDER
foreach ($this->getState('query.order', array()) as $order) {
$query->order($order);
}
//ORDER
$orderCol = $this->getState('list.ordering');
$orderDir = $this->getState('list.direction', 'asc');
if ($orderCol) {
$query->order($orderCol . ' ' . $orderDir);
}
}