本文整理汇总了PHP中FOFModel类的典型用法代码示例。如果您正苦于以下问题:PHP FOFModel类的具体用法?PHP FOFModel怎么用?PHP FOFModel使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了FOFModel类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: 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;
}
开发者ID:julienV,项目名称:Joomla-Tracks,代码行数:32,代码来源:profile.php
示例2: 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);
}
开发者ID:deenison,项目名称:joomla-cms,代码行数:35,代码来源:view.html.php
示例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');
}
开发者ID:alvarovladimir,项目名称:messermeister_ab_rackservers,代码行数:31,代码来源:view.html.php
示例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());
}
开发者ID:yalive,项目名称:com_api-plugins,代码行数:28,代码来源:subscriptions.php
示例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;
}
开发者ID:ranrolls,项目名称:ras-full-portal,代码行数:25,代码来源:tag.php
示例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;
}
开发者ID:katebmedia,项目名称:SP-Simple-Portfolio,代码行数:57,代码来源:item.php
示例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);
}
开发者ID:shoffmann52,项目名称:install-from-web-server,代码行数:18,代码来源:toolbar.php
示例8: ajax
public function ajax()
{
$act = $this->input->get('act', '', 'cmd');
$model = FOFModel::getAnInstance('Confwiz', 'AkeebaModel');
$model->setState('act', $act);
$ret = $model->runAjax();
@ob_end_clean();
echo '###' . json_encode($ret) . '###';
flush();
JFactory::getApplication()->close();
}
开发者ID:alvarovladimir,项目名称:messermeister_ab_rackservers,代码行数:11,代码来源:confwiz.php
示例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);
}
开发者ID:unrealprojects,项目名称:journal,代码行数:53,代码来源:extensions.php
示例10: 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;
}
开发者ID:01J,项目名称:skazkipronebo,代码行数:58,代码来源:model.php
示例11: 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');
}
开发者ID:greyhat777,项目名称:vuslinterliga,代码行数:13,代码来源:view.html.php
示例12: onDisplay
public function onDisplay($tpl = null)
{
$model = $this->getModel();
$task = $model->getState('task', 'components');
// Add submenus (those nifty text links below the toolbar!)
$toolbar = FOFToolbar::getAnInstance($this->input->get('option', 'com_foobar', 'cmd'), $this->config);
$link = JURI::base() . '?option=com_akeeba&view=extfilter&task=components';
$toolbar->appendLink(JText::_('EXTFILTER_COMPONENTS'), $link, $task == 'components');
$link = JURI::base() . '?option=com_akeeba&view=extfilter&task=modules';
$toolbar->appendLink(JText::_('EXTFILTER_MODULES'), $link, $task == 'modules');
$link = JURI::base() . '?option=com_akeeba&view=extfilter&task=plugins';
$toolbar->appendLink(JText::_('EXTFILTER_PLUGINS'), $link, $task == 'plugins');
$link = JURI::base() . '?option=com_akeeba&view=extfilter&task=languages';
$toolbar->appendLink(JText::_('EXTFILTER_LANGUAGES'), $link, $task == 'languages');
$link = JURI::base() . '?option=com_akeeba&view=extfilter&task=templates';
$toolbar->appendLink(JText::_('EXTFILTER_TEMPLATES'), $link, $task == 'templates');
switch ($task) {
case 'components':
// Pass along the list of components
$this->components = $model->getComponents();
break;
case 'modules':
// Pass along the list of components
$this->modules = $model->getModules();
break;
case 'plugins':
// Pass along the list of components
$this->plugins = $model->getPlugins();
break;
case 'templates':
// Pass along the list of components
$this->templates = $model->getTemplates();
break;
case 'languages':
// Pass along the list of components
$this->languages = $model->getLanguages();
break;
}
$this->setLayout($task);
// Add live help
AkeebaHelperIncludes::addHelp('extfilter');
// 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;
}
开发者ID:sillysachin,项目名称:teamtogether,代码行数:51,代码来源:view.html.php
示例13: 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);
}
开发者ID:fracting,项目名称:cmc,代码行数:14,代码来源:ecom360akeeba.php
示例14: onBeforeBrowse
public function onBeforeBrowse()
{
$result = parent::onBeforeBrowse();
if ($result) {
$params = JComponentHelper::getParams('com_akeeba');
$model = $this->getThisModel();
$view = $this->getThisView();
/** @var AkeebaModelCpanels $model */
$view->setModel($model);
$aeconfig = AEFactory::getConfiguration();
// Invalidate stale backups
AECoreKettenrad::reset(array('global' => true, 'log' => false, 'maxrun' => $params->get('failure_timeout', 180)));
// Just in case the reset() loaded a stale configuration...
AEPlatform::getInstance()->load_configuration();
// Let's make sure the temporary and output directories are set correctly and writable...
$wizmodel = FOFModel::getAnInstance('Confwiz', 'AkeebaModel');
$wizmodel->autofixDirectories();
// Check if we need to toggle the settings encryption feature
$model->checkSettingsEncryption();
// Update the magic component parameters
$model->updateMagicParameters();
// Run the automatic database check
$model->checkAndFixDatabase();
// Run the automatic update site refresh
$model->refreshUpdateSite();
// Check the last installed version
$versionLast = null;
if (file_exists(JPATH_COMPONENT_ADMINISTRATOR . '/akeeba.lastversion.php')) {
include_once JPATH_COMPONENT_ADMINISTRATOR . '/akeeba.lastversion.php';
if (defined('AKEEBA_LASTVERSIONCHECK')) {
$versionLast = AKEEBA_LASTVERSIONCHECK;
}
}
if (is_null($versionLast)) {
$component = JComponentHelper::getComponent('com_akeeba');
if (is_object($component->params) && $component->params instanceof JRegistry) {
$params = $component->params;
} else {
$params = new JParameter($component->params);
}
$versionLast = $params->get('lastversion', '');
}
if (version_compare(AKEEBA_VERSION, $versionLast, 'ne') || empty($versionLast)) {
$this->setRedirect('index.php?option=com_akeeba&view=postsetup');
return true;
}
}
return $result;
}
开发者ID:sankam-nikolya,项目名称:lptt,代码行数:49,代码来源:cpanel.php
示例15: 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();
}
开发者ID:sankam-nikolya,项目名称:lptt,代码行数:15,代码来源:check.php
示例16: 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;
}
开发者ID:alvarovladimir,项目名称:messermeister_ab_rackservers,代码行数:23,代码来源:profiles.php
示例17: onBrowse
public function onBrowse($tpl = null)
{
$media_folder = JURI::base() . '../media/com_akeeba/';
// Get the root URI for media files
$this->assign('mediadir', AkeebaHelperEscape::escapeJS($media_folder . 'theme/'));
// Get a JSON representation of the available roots
$filters = AEFactory::getFilters();
$root_info = $filters->getInclusions('dir');
$roots = array();
$options = array();
if (!empty($root_info)) {
// Loop all dir definitions
foreach ($root_info as $dir_definition) {
if (is_null($dir_definition[1])) {
// Site root definition has a null element 1. It is always pushed on top of the stack.
array_unshift($roots, $dir_definition[0]);
} else {
$roots[] = $dir_definition[0];
}
$options[] = JHTML::_('select.option', $dir_definition[0], $dir_definition[0]);
}
}
$site_root = $roots[0];
$attribs = 'onchange="akeeba_active_root_changed();"';
$this->assign('root_select', JHTML::_('select.genericlist', $options, 'root', $attribs, 'value', 'text', $site_root, 'active_root'));
$this->assign('roots', $roots);
$tpl = null;
// Get a JSON representation of the directory data
$model = $this->getModel();
$json = json_encode($model->get_regex_filters($site_root));
$this->assignRef('json', $json);
// Add live help
AkeebaHelperIncludes::addHelp('regexfsfilter');
// Get profile ID
$profileid = AEPlatform::getInstance()->get_active_profile();
$this->assign('profileid', $profileid);
// Get profile name
$pmodel = FOFModel::getAnInstance('Profiles', 'AkeebaModel');
$pmodel->setId($profileid);
$profile_data = $pmodel->getItem();
$this->assign('profilename', $profile_data->description);
return true;
}
开发者ID:alvarovladimir,项目名称:messermeister_ab_rackservers,代码行数:43,代码来源:view.html.php
示例18: onBrowse
public function onBrowse($tpl = null)
{
// Add live help
AkeebaHelperIncludes::addHelp('log');
// Get a list of log names
$model = $this->getModel();
$this->logs = $model->getLogList();
$tag = $model->getState('tag');
if (empty($tag)) {
$tag = null;
}
$this->tag = $tag;
// 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;
}
开发者ID:sankam-nikolya,项目名称:lptt,代码行数:22,代码来源:view.html.php
示例19: add
public function add()
{
$mainframe = JFactory::getApplication();
$option = $this->input->getCmd('option', 'com_tracks');
$db = JFactory::getDBO();
$individualid = $this->input->getInt("individualid", 0);
$name = $this->input->get("quickadd", '', 'request', 'string');
$srid = $this->input->getInt("subround_id", 0);
$projectid = $mainframe->getUserState($option . "project");
// add the new individual as their name was sent through.
if (!$individualid) {
$model = FOFModel::getAnInstance('Individuals', 'TracksModel');
$name = explode(" ", $name);
$firstname = ucfirst(array_shift($name));
$lastname = ucfirst(implode(" ", $name));
$data = array("first_name" => $firstname, "last_name" => $lastname);
$res = $model->save($data);
if (!$res) {
$msg = Jtext::_('COM_TRACKS_Error_adding_individual') . ': ' . $model->getError();
$this->setRedirect("index.php?option=com_tracks&view=subroundresults&subround_id=" . $srid, $msg, 'error');
}
$individualid = $model->getId();
}
// check if indivual belongs to project
$query = ' SELECT individual_id FROM #__tracks_projects_individuals ' . ' WHERE project_id = ' . $db->Quote($projectid) . ' AND individual_id = ' . $db->Quote($individualid);
$db->setQuery($query);
$res = $db->loadResult();
if (!$res) {
$db->setQuery("INSERT INTO #__tracks_projects_individuals (individual_id, project_id) VALUES (" . $individualid . ", " . $projectid . ")");
$db->query();
}
// assign the individual to the subround.
if ($individualid && $srid) {
$db->setQuery("INSERT INTO #__tracks_rounds_results (individual_id, subround_id) VALUES (" . $individualid . ", " . $srid . ")");
$db->query();
}
$this->setRedirect("index.php?option=com_tracks&view=subroundresults&subround_id=" . $srid);
}
开发者ID:julienV,项目名称:Joomla-Tracks,代码行数:38,代码来源:quickadd.php
示例20: onBrowse
public function onBrowse($tpl = null)
{
$media_folder = JURI::base() . '../media/com_akeeba/';
// Get the root URI for media files
$this->mediadir = AkeebaHelperEscape::escapeJS($media_folder . 'theme/');
// Get a JSON representation of the available roots
$model = $this->getModel();
$root_info = $model->get_roots();
$roots = array();
if (!empty($root_info)) {
// Loop all dir definitions
foreach ($root_info as $def) {
$roots[] = $def->value;
$options[] = JHTML::_('select.option', $def->value, $def->text);
}
}
$site_root = '[SITEDB]';
$attribs = 'onchange="akeeba_active_root_changed();"';
$this->root_select = JHTML::_('select.genericlist', $options, 'root', $attribs, 'value', 'text', $site_root, 'active_root');
$this->roots = $roots;
$tpl = null;
// Get a JSON representation of the directory data
$model = $this->getModel();
$json = json_encode($model->get_regex_filters($site_root));
$this->json = $json;
// Add live help
AkeebaHelperIncludes::addHelp('regexdbfilter');
// 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;
}
开发者ID:sillysachin,项目名称:teamtogether,代码行数:37,代码来源:view.html.php
注:本文中的FOFModel类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论