本文整理汇总了PHP中TemplatesHelper::isTemplateAssigned方法的典型用法代码示例。如果您正苦于以下问题:PHP TemplatesHelper::isTemplateAssigned方法的具体用法?PHP TemplatesHelper::isTemplateAssigned怎么用?PHP TemplatesHelper::isTemplateAssigned使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TemplatesHelper
的用法示例。
在下文中一共展示了TemplatesHelper::isTemplateAssigned方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: viewTemplates
/**
* Compiles a list of installed, version 4.5+ templates
*
* Based on xml files found. If no xml file found the template
* is ignored
*/
public static function viewTemplates()
{
global $mainframe, $option;
// Initialize some variables
$db =& JFactory::getDBO();
$client =& JApplicationHelper::getClientInfo(JRequest::getVar('client', '0', '', 'int'));
// Initialize the pagination variables
$limit = $mainframe->getUserStateFromRequest('global.list.limit', 'limit', 20, 'int');
$limitstart = $mainframe->getUserStateFromRequest($option . '.' . $client->id . '.limitstart', 'limitstart', 0, 'int');
$select[] = JHTML::_('select.option', '0', JText::_('Site'));
$select[] = JHTML::_('select.option', '1', JText::_('Administrator'));
$lists['client'] = JHTML::_('select.genericlist', $select, 'client', 'class="inputbox" size="1" onchange="document.adminForm.submit();"', 'value', 'text', $client->id);
$tBaseDir = $client->path . DS . 'templates';
//get template xml file info
$rows = array();
$rows = TemplatesHelper::parseXMLTemplateFiles($tBaseDir);
// set dynamic template information
for ($i = 0; $i < count($rows); $i++) {
$rows[$i]->assigned = TemplatesHelper::isTemplateAssigned($rows[$i]->directory);
$rows[$i]->published = TemplatesHelper::isTemplateDefault($rows[$i]->directory, $client->id);
}
jimport('joomla.html.pagination');
$page = new JPagination(count($rows), $limitstart, $limit);
$rows = array_slice($rows, $page->limitstart, $page->limit);
require_once JPATH_COMPONENT . DS . 'admin.templates.html.php';
TemplatesView::showTemplates($rows, $lists, $page, $option, $client);
}
示例2: listing
//.........这里部分代码省略.........
if (preg_match('#^.*_(?!configuration).*\\.php$#', $file)) {
$obj = new stdClass();
$obj->path = $plugins_folder . DS . $file;
$obj->filename = $file;
$obj->folder = $plugins_folder;
$obj->client_id = $client_id;
$obj->type = 'plugin';
$obj->view = '';
$obj->type_name = 'hikashoppayment';
$obj->file = substr($file, 0, strlen($file) - 4);
$clientTemplates[] = $obj;
}
}
}
}
if (!empty($clientTemplates)) {
$client = JApplicationHelper::getClientInfo($client_id);
$tBaseDir = $client->path . DS . 'templates';
if (version_compare(JVERSION, '1.6', '<')) {
$joomlaTemplates = TemplatesHelper::parseXMLTemplateFiles($tBaseDir);
} else {
$query = 'SELECT * FROM ' . hikashop_table('extensions', false) . ' WHERE type=\'template\' AND client_id=' . (int) $client_id;
$db = JFactory::getDBO();
$db->setQuery($query);
$joomlaTemplates = $db->loadObjectList();
foreach ($joomlaTemplates as $k => $v) {
$joomlaTemplates[$k]->assigned = $joomlaTemplates[$k]->protected;
$joomlaTemplates[$k]->published = $joomlaTemplates[$k]->enabled;
$joomlaTemplates[$k]->directory = $joomlaTemplates[$k]->element;
}
}
for ($i = 0; $i < count($joomlaTemplates); $i++) {
if (version_compare(JVERSION, '1.6', '<')) {
$joomlaTemplates[$i]->assigned = TemplatesHelper::isTemplateAssigned($joomlaTemplates[$i]->directory);
$joomlaTemplates[$i]->published = TemplatesHelper::isTemplateDefault($joomlaTemplates[$i]->directory, $client->id);
}
if ($joomlaTemplates[$i]->published || $joomlaTemplates[$i]->assigned) {
if (!empty($pageInfo->filter->template) && $joomlaTemplates[$i]->directory != $pageInfo->filter->template) {
continue;
}
$templateValues[$joomlaTemplates[$i]->directory] = $joomlaTemplates[$i]->directory;
$templateFolder = $tBaseDir . DS . $joomlaTemplates[$i]->directory . DS;
foreach ($clientTemplates as $template) {
$templatePerJoomlaTemplate = clone $template;
$templatePerJoomlaTemplate->template = $joomlaTemplates[$i]->directory;
$templatePerJoomlaTemplate->component = $component_name;
$templatePerJoomlaTemplate->override = $templateFolder . 'html' . DS . $template->type_name . DS;
if ($template->type == 'component') {
$templatePerJoomlaTemplate->override .= $template->view . DS;
}
$templatePerJoomlaTemplate->override .= $template->filename;
$templatePerJoomlaTemplate->overriden = false;
if (file_exists($templatePerJoomlaTemplate->override)) {
$templatePerJoomlaTemplate->overriden = true;
}
$templatePerJoomlaTemplate->id = $templatePerJoomlaTemplate->client_id . '|' . $templatePerJoomlaTemplate->template . '|' . $templatePerJoomlaTemplate->type . '|' . $templatePerJoomlaTemplate->type_name . '|' . $templatePerJoomlaTemplate->view . '|' . $templatePerJoomlaTemplate->filename;
$key = $templatePerJoomlaTemplate->client_id . '|' . $templatePerJoomlaTemplate->template . '|' . $templatePerJoomlaTemplate->type_name . '|' . $templatePerJoomlaTemplate->view . '|' . $templatePerJoomlaTemplate->filename;
if (!empty($pageInfo->filter->viewType) && $templatePerJoomlaTemplate->view != $pageInfo->filter->viewType) {
continue;
}
$templates[$key] = $templatePerJoomlaTemplate;
}
if (JFolder::exists($templateFolder . 'html' . DS . $component . DS)) {
$folders = JFolder::folders($templateFolder . 'html' . DS . $component . DS);
if (!empty($folders)) {
foreach ($folders as $folder) {
示例3: editTemplate
function editTemplate()
{
jimport('joomla.filesystem.path');
// Initialize some variables
$db =& JFactory::getDBO();
$cid = JRequest::getVar('cid', array(), 'method', 'array');
$cid = array(JFilterInput::clean(@$cid[0], 'cmd'));
$template = $cid[0];
$option = JRequest::getCmd('option');
$client =& JApplicationHelper::getClientInfo(JRequest::getVar('client', '0', '', 'int'));
if (!$cid[0]) {
return JError::raiseWarning(500, JText::_('Template not specified'));
}
$tBaseDir = JPath::clean($client->path . DS . 'templates');
if (!is_dir($tBaseDir . DS . $template)) {
return JError::raiseWarning(500, JText::_('Template not found'));
}
$lang =& JFactory::getLanguage();
$lang->load('tpl_' . $template, JPATH_ADMINISTRATOR);
$ini = $client->path . DS . 'templates' . DS . $template . DS . 'params.ini';
$xml = $client->path . DS . 'templates' . DS . $template . DS . 'templateDetails.xml';
$row = TemplatesHelper::parseXMLTemplateFile($tBaseDir, $template);
jimport('joomla.filesystem.file');
// Read the ini file
if (JFile::exists($ini)) {
$content = JFile::read($ini);
} else {
$content = null;
}
$params = new JParameter($content, $xml, 'template');
$assigned = TemplatesHelper::isTemplateAssigned($row->directory);
$default = TemplatesHelper::isTemplateDefault($row->directory, $client->id);
if ($client->id == '1') {
$lists['selections'] = JText::_('Cannot assign an administrator template');
} else {
$lists['selections'] = TemplatesHelper::createMenuList($template);
}
if ($default) {
$row->pages = 'all';
} elseif (!$assigned) {
$row->pages = 'none';
} else {
$row->pages = null;
}
// Set FTP credentials, if given
jimport('joomla.client.helper');
$ftp =& JClientHelper::setCredentialsFromRequest('ftp');
require_once JPATH_COMPONENT . DS . 'admin.templates.html.php';
TemplatesView::editTemplate($row, $lists, $params, $option, $client, $ftp, $template);
}