本文整理汇总了PHP中FOFModel::getTmpInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP FOFModel::getTmpInstance方法的具体用法?PHP FOFModel::getTmpInstance怎么用?PHP FOFModel::getTmpInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FOFModel
的用法示例。
在下文中一共展示了FOFModel::getTmpInstance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: display
/**
* Execute and display a template script.
*
* @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 Error object.
*/
public function display($tpl = null)
{
// Set toolbar items for the page
JToolbarHelper::title(JText::_('COM_CPANEL'), 'home-2 cpanel');
JToolbarHelper::help('screen.cpanel');
$input = JFactory::getApplication()->input;
/*
* Set the template - this will display cpanel.php
* from the selected admin template.
*/
$input->set('tmpl', 'cpanel');
// Display the cpanel modules
$this->modules = JModuleHelper::getModules('cpanel');
// Load the RAD layer and count the number of post-installation messages
if (!defined('FOF_INCLUDED')) {
require_once JPATH_LIBRARIES . '/fof/include.php';
}
try {
$messages_model = FOFModel::getTmpInstance('Messages', 'PostinstallModel')->eid(700);
$messages = $messages_model->getItemList();
} catch (RuntimeException $e) {
$messages = array();
// Still render the error message from the Exception object
JFactory::getApplication()->enqueueMessage($e->getMessage(), 'error');
}
$this->postinstall_message_count = count($messages);
parent::display($tpl);
}
示例2: onBeforeAdd
/**
* redirects to correct view...
*
* @return bool
*
* @throws Exception
*/
public function onBeforeAdd()
{
$user = JFactory::getUser();
if (!$user) {
throw new Exception('access not allowed', 403);
}
// If the user is logged, check if he already has a profile
$model = FOFModel::getTmpInstance('IndividualEdits', 'TracksModel');
$ind = $model->getUserIndividual($user->get('id'));
if (!$ind) {
$allow_register = JComponentHelper::getParams('com_tracks')->get('user_registration', 0);
if (!$allow_register) {
throw new Exception('Create individuals not allowed', 403);
}
// Redirect to individual edit
$link = JRoute::_(TrackslibHelperRoute::getEditIndividualRoute());
} else {
// Redirect to individual edit
$link = JRoute::_(TrackslibHelperRoute::getEditIndividualRoute($ind));
}
$this->setRedirect($link);
$this->redirect();
// We shouldn't arrive at that point ;)
return false;
}
示例3: onAdd
public function onAdd($tpl = null)
{
$media_folder = JURI::base() . '../media/com_akeeba/';
// Get a JSON representation of GUI data
$json = AkeebaHelperEscape::escapeJS(AEUtilInihelper::getJsonGuiDefinition(), '"\\');
$this->assignRef('json', $json);
// Get profile ID
$profileid = AEPlatform::getInstance()->get_active_profile();
$this->assign('profileid', $profileid);
// Get profile name
$profileName = FOFModel::getTmpInstance('Profiles', 'AkeebaModel')->setId($profileid)->getItem()->description;
$this->assign('profilename', $profileName);
// Get the root URI for media files
$this->assign('mediadir', AkeebaHelperEscape::escapeJS($media_folder . 'theme/'));
// Are the settings secured?
if (AEPlatform::getInstance()->get_platform_configuration_option('useencryption', -1) == 0) {
$this->assign('securesettings', -1);
} elseif (!AEUtilSecuresettings::supportsEncryption()) {
$this->assign('securesettings', 0);
} else {
JLoader::import('joomla.filesystem.file');
$filename = JPATH_COMPONENT_ADMINISTRATOR . '/akeeba/serverkey.php';
if (JFile::exists($filename)) {
$this->assign('securesettings', 1);
} else {
$this->assign('securesettings', 0);
}
}
// Add live help
AkeebaHelperIncludes::addHelp('config');
}
示例4: get
public function get()
{
$input = JFactory::getApplication()->input;
$user = $this->plugin->getUser();
$filters = array('search' => '', 'title' => '', 'enabled' => '', 'level' => '', 'publish_up' => '', 'publish_down' => '', 'user_id', 'paystate' => '', 'processor' => '', 'paykey' => '', 'since' => '', 'until' => '', 'contact_flag' => '', 'expires_from' => '', 'expires_to' => '', 'refresh' => '', 'groupbydate' => '', 'groupbyweek' => '', 'groupbylevel' => '', 'moneysum' => '', 'coupon_id' => '', 'filter_discountmode' => '', 'filter_discountcode' => '', 'nozero' => '', 'nojoins' => '');
if (!$user) {
$this->plugin->setResponse($this->getErrorResponse(404, JText::_('JERROR_ALERTNOAUTHOR')));
return;
}
$authorised = $user->authorise('core.manage', 'com_akeebasubs');
if (!$authorised) {
$this->plugin->setResponse($this->getErrorResponse(404, JText::_('JERROR_ALERTNOAUTHOR')));
return;
}
$subscriptionsmodel = FOFModel::getTmpInstance('Subscriptions', 'AkeebasubsModel');
$order = $input->get('filter_order', 'akeebasubs_subscription_id');
$orderdir = $input->get('filter_order_Dir', 'DESC');
if (!in_array($order, array_keys($subscriptionsmodel->getTable()->getData()))) {
$order = 'akeebasubs_subscription_id';
}
$subscriptionsmodel->setState('filter_order', $order);
$subscriptionsmodel->setState('filter_order_Dir', $orderdir);
foreach ($filters as $filter => $val) {
$subscriptionsmodel->setState($filter, $input->get($filter, $val));
}
$subscriptionsmodel->limit($input->get('limit', 10))->limitstart($input->get('limit', 0));
$this->plugin->setResponse($subscriptionsmodel->getList());
}
示例5: check
public function check()
{
$result = true;
//Alias
if (empty($this->alias)) {
$this->alias = JFilterOutput::stringURLSafe($this->title);
} else {
$this->alias = JFilterOutput::stringURLSafe($this->alias);
}
$existingAlias = FOFModel::getTmpInstance('Tags', 'SpsimpleportfolioModel')->alias($this->alias)->getList(true);
if (!empty($existingAlias)) {
$count = 0;
$k = $this->getKeyName();
foreach ($existingAlias as $item) {
if ($item->{$k} != $this->{$k}) {
$count++;
}
}
if ($count) {
$this->setError(JText::_('COM_SPSIMPLEPORTFOLIO_ALIAS_ERR_SLUGUNIQUE'));
$result = false;
}
}
return $result;
}
示例6: check
public function check()
{
$result = true;
//Alias
if (empty($this->alias)) {
// Auto-fetch a alias
$this->alias = JFilterOutput::stringURLSafe($this->title);
} else {
// Make sure nobody adds crap characters to the alias
$this->alias = JFilterOutput::stringURLSafe($this->alias);
}
$existingAlias = FOFModel::getTmpInstance('Items', 'SpsimpleportfolioModel')->alias($this->alias)->getList(true);
if (!empty($existingAlias)) {
$count = 0;
$k = $this->getKeyName();
foreach ($existingAlias as $item) {
if ($item->{$k} != $this->{$k}) {
$count++;
}
}
if ($count) {
$this->setError(JText::_('COM_SPSIMPLEPORTFOLIO_ALIAS_ERR_SLUGUNIQUE'));
$result = false;
}
}
//Tags
if (is_array($this->spsimpleportfolio_tag_id)) {
if (!empty($this->spsimpleportfolio_tag_id)) {
$this->spsimpleportfolio_tag_id = json_encode($this->spsimpleportfolio_tag_id);
}
}
if (is_null($this->spsimpleportfolio_tag_id) || empty($this->spsimpleportfolio_tag_id)) {
$this->spsimpleportfolio_tag_id = '';
}
//Generate Thumbnails
if ($result) {
$params = JComponentHelper::getParams('com_spsimpleportfolio');
$square = strtolower($params->get('square', '600x600'));
$rectangle = strtolower($params->get('rectangle', '600x400'));
$tower = strtolower($params->get('tower', '600x800'));
$cropratio = $params->get('cropratio', 4);
if (!is_null($this->image)) {
jimport('joomla.filesystem.file');
jimport('joomla.filesystem.folder');
jimport('joomla.image.image');
$image = JPATH_ROOT . '/' . $this->image;
$path = JPATH_ROOT . '/images/spsimpleportfolio/' . $this->alias;
if (!file_exists($path)) {
JFolder::create($path, 0755);
}
$sizes = array($square, $rectangle, $tower);
$image = new JImage($image);
$image->createThumbs($sizes, $cropratio, $path);
}
}
return $result;
}
示例7: onMessages
/**
* Setup the toolbar and title
*
* @return void
*
* @since 3.2
*/
public function onMessages()
{
$extension_name = JText::_('COM_POSTINSTALL_TITLE_JOOMLA');
$eid = $this->input->getInt('eid', 700);
if ($eid != 700) {
$model = FOFModel::getTmpInstance('Messages', 'PostinstallModel');
$extension_name = $model->getExtensionName($eid);
}
JToolBarHelper::title(JText::sprintf('COM_POSTINSTALL_MESSAGES_TITLE', $extension_name));
JToolBarHelper::preferences($this->config['option'], 550, 875);
}
示例8: getOptions
/**
* Method to get the field options.
*
* @return array The field option objects.
*/
protected function getOptions()
{
$options = array();
// Initialize some field attributes.
$key = $this->element['key_field'] ? (string) $this->element['key_field'] : 'value';
$value = $this->element['value_field'] ? (string) $this->element['value_field'] : (string) $this->element['name'];
$applyAccess = $this->element['apply_access'] ? (string) $this->element['apply_access'] : 'false';
$modelName = (string) $this->element['model'];
$nonePlaceholder = (string) $this->element['none'];
$translate = empty($this->element['translate']) ? 'true' : (string) $this->element['translate'];
$translate = in_array(strtolower($translate), array('true', 'yes', '1', 'on')) ? true : false;
if (!empty($nonePlaceholder)) {
$options[] = JHtml::_('select.option', JText::_($nonePlaceholder), null);
}
// Process field atrtibutes
$applyAccess = strtolower($applyAccess);
$applyAccess = in_array($applyAccess, array('yes', 'on', 'true', '1'));
// Explode model name into model name and prefix
$parts = FOFInflector::explode($modelName);
$mName = ucfirst(array_pop($parts));
$mPrefix = FOFInflector::implode($parts);
// Get the model object
$config = array('savestate' => 0);
$model = FOFModel::getTmpInstance($mName, $mPrefix, $config);
if ($applyAccess) {
$model->applyAccessFiltering();
}
// Process state variables
foreach ($this->element->children() as $stateoption) {
// Only add <option /> elements.
if ($stateoption->getName() != 'state') {
continue;
}
$stateKey = (string) $stateoption['key'];
$stateValue = (string) $stateoption;
$model->setState($stateKey, $stateValue);
}
// Set the query and get the result list.
$items = $model->getItemList(true);
// Build the field options.
if (!empty($items)) {
foreach ($items as $item) {
if ($translate == true) {
$options[] = JHtml::_('select.option', $item->{$key}, JText::_($item->{$value}));
} else {
$options[] = JHtml::_('select.option', $item->{$key}, $item->{$value});
}
}
}
// Merge any additional options in the XML definition.
$options = array_merge(parent::getOptions(), $options);
return $options;
}
示例9: getExtensionsAndVersions
public static function getExtensionsAndVersions()
{
require_once dirname(__FILE__) . '/../models/jextensions.php';
require_once dirname(__FILE__) . '/../models/elements.php';
require_once dirname(__FILE__) . '/../models/apps.php';
$jmodel = FOFModel::getTmpInstance('JExtensions', 'ZLManagerModel', array('input' => array()));
$emodel = FOFModel::getTmpInstance('Elements', 'ZLManagerModel', array('input' => array()));
$amodel = FOFModel::getTmpInstance('Apps', 'ZLManagerModel', array('input' => array()));
$extensions = FOFModel::getTmpInstance('Extensions', 'ZLManagerModel', array('input' => array()))->getItemList();
$exts = array();
foreach ($extensions as &$e) {
// QUick naming fix
if (trim($e->title) == 'ZL Extensions Manager') {
$e->title = 'ZLManager';
}
$exts[] = trim($e->title);
}
// Filter extensions
$jmodel->setState('extensions', $exts);
$jextensions = $jmodel->getItemList();
// Get Elements
$elements = $emodel->getItemList();
// Get Apps
$apps = $amodel->getItemList();
// Extensions
$jexts = array();
$jextsv = array();
foreach ($jextensions as $je) {
$jexts[] = $je->name;
$jextsv[$je->name] = $je->version;
}
// Elements
$el = array();
$elv = array();
if ($elements && count($elements)) {
foreach ($elements as $e) {
$el[] = $e->getMetaData('name');
$elv[$e->getMetaData('name')] = $e->getMetaData('version');
}
}
// Apps
$applications = array();
$applicationsv = array();
if ($apps && count($apps)) {
foreach ($apps as $a) {
$applications[] = $a->getMetaData('name');
$applicationsv[$a->getMetaData('name')] = $a->getMetaData('version');
}
}
$jexts = array_merge($jexts, $el, $applications);
$jextv = array_merge($jextsv, $elv, $applicationsv);
return array('extensions' => $jexts, 'versions' => $jextv);
}
示例10: onAdd
public function onAdd($tpl = null)
{
// Get profile ID
$profileid = AEPlatform::getInstance()->get_active_profile();
$this->profileid = $profileid;
// Get profile name
$profileName = FOFModel::getTmpInstance('Profiles', 'AkeebaModel')->setId($profileid)->getItem()->description;
$this->profilename = $profileName;
// Get the CRON paths
$this->croninfo = $this->getModel()->getPaths();
// Add live help
AkeebaHelperIncludes::addHelp('schedule');
}
示例11: notifyMC
private function notifyMC($row, $info)
{
$session = JFactory::getSession();
// Trigger plugin only if user comes from Mailchimp
if (!$session->get('mc', '0')) {
return;
}
$shop_name = $this->params->get("store_name", "Your shop");
$shop_id = $this->params->get("store_id", 42);
$akeebasubsLevel = FOFModel::getTmpInstance('Levels', 'AkeebasubsModel')->setId($row->akeebasubs_level_id)->getItem();
$akeeba_subscription_name = $akeebasubsLevel->title;
$products = array(0 => array("product_id" => $info['current']->akeebasubs_level_id, "sku" => "", "product_name" => $akeeba_subscription_name, "category_id" => 0, "category_name" => "", "qty" => 1.0, "cost" => $info['current']->gross_amount));
CmcHelperEcom360::sendOrderInformations($shop_id, $shop_name, $info['current']->akeebasubs_subscription_id, $info['current']->gross_amount, $info['current']->tax_percent, 0.0, $products);
}
示例12: browse
public function browse()
{
// Check permissions
$this->_checkPermissions();
/** @var AkeebaModelStatistics $model */
$model = FOFModel::getTmpInstance('Statistics', 'AkeebaModel');
$model->setInput($this->input);
$result = $model->notifyFailed();
$message = $result['result'] ? '200 ' : '500 ';
$message .= implode(', ', $result['message']);
@ob_end_clean();
echo $message;
flush();
JFactory::getApplication()->close();
}
示例13: copy
/**
* Tries to copy the profile whose ID is set in the model to a new record
*
* @return bool True on success
*/
public function copy()
{
$id = $this->getId();
// Check for invalid id's (not numeric, or <= 0)
if (!is_numeric($id) || $id <= 0) {
$this->setError(JText::_('PROFILE_INVALID_ID'));
return false;
}
$profile = FOFModel::getTmpInstance('Profiles', 'AkeebaModel')->setId($id)->getItem()->getData();
$profile['id'] = 0;
$oProfile = $this->getTable();
$oProfile->reset();
$status = $oProfile->save($profile);
if ($status) {
$this->setId($oProfile->id);
}
return $status;
}
示例14: onBrowse
public function onBrowse($tpl = null)
{
// Add live help
//AkeebaHelperIncludes::addHelp('alice');
// Get a list of log names
$model = $this->getModel();
$this->logs = FOFModel::getTmpInstance('Logs', 'AkeebaModel')->getLogList();
$log = $model->getState('log');
if (empty($log)) {
$log = null;
}
$this->log = $log;
// Get profile ID
$profileid = AEPlatform::getInstance()->get_active_profile();
$this->profileid = $profileid;
// Get profile name
$pmodel = FOFModel::getAnInstance('Profiles', 'AkeebaModel');
$pmodel->setId($profileid);
$profile_data = $pmodel->getItem();
$this->profilename = $profile_data->description;
return true;
}
示例15: onDisplay
public function onDisplay($tpl = null)
{
$aeconfig = AEFactory::getConfiguration();
// Add live help
AkeebaHelperIncludes::addHelp('stw');
$model = $this->getModel();
$step = $model->getState('stwstep', 1);
switch ($step) {
case 1:
default:
$cpanelmodel = FOFModel::getTmpInstance('Cpanels', 'AkeebaModel');
$this->profilelist = $cpanelmodel->getProfilesList();
$this->stw_profile_id = $model->getSTWProfileID();
break;
case 2:
$this->opts = $model->getTransferSettings();
break;
case 3:
break;
}
$this->setLayout('step' . $step);
return true;
}