当前位置: 首页>>代码示例>>PHP>>正文


PHP FOFPlatform类代码示例

本文整理汇总了PHP中FOFPlatform的典型用法代码示例。如果您正苦于以下问题:PHP FOFPlatform类的具体用法?PHP FOFPlatform怎么用?PHP FOFPlatform使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了FOFPlatform类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: onDisplay

 /**
  * The event which runs when we are displaying the record list JSON view
  *
  * @param   string  $tpl  The view sub-template to use
  *
  * @return  boolean  True to allow display of the view
  */
 protected function onDisplay($tpl = null)
 {
     $document = FOFPlatform::getInstance()->getDocument();
     if ($document instanceof JDocument) {
         $document->setMimeEncoding('application/json');
     }
     // Load the model
     $model = $this->getModel();
     $items = $model->getItemList();
     $categories = $model->getCategories();
     $publicFields = array("babioonevent_event_id", "name", "organiser", "sdate", "stime", "stimeset", "edate", "etime", "etimeset", "contact", "tel", "website", "address", "ainfo", "street", "pcode", "city", "state", "country", "geo_b", "geo_l", "teaser", "text", "isfreeofcharge", "charge", "picturefile", "created", "modified", "customfield1", "customfield2", "customfield3", "customfield4", "link");
     $publicData = array();
     foreach ($items as $item) {
         $data = array();
         foreach ($publicFields as $field) {
             $data[$field] = $item->{$field};
         }
         $data['category'] = '';
         if (array_key_exists($item->catid, $categories)) {
             $data['category'] = $categories[$item->catid]->title;
         }
         if ($item->showemail == 1) {
             $data['email'] = $item->email;
         }
         $publicData[] = $data;
     }
     $json = json_encode($publicData);
     echo $json;
     return false;
 }
开发者ID:rdeutz,项目名称:babioon-event,代码行数:37,代码来源:view.json.php

示例2: loadView

 protected function loadView($view)
 {
     if ('images' == $view || 'imagesList' == $view) {
         $overridePath = FOFPlatform::getInstance()->getTemplateOverridePath('com_media', true) . '/' . $view;
         require_once $overridePath . '/view.html.php';
     }
 }
开发者ID:jimfrenette,项目名称:joomla,代码行数:7,代码来源:mcm.php

示例3: getOptions

 /**
  * Create objects for the options
  *
  * @return  array  The array of 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'];
     $translate = $this->element['translate'] ? (string) $this->element['translate'] : false;
     $query = (string) $this->element['query'];
     // Get the database object.
     $db = FOFPlatform::getInstance()->getDbo();
     // Set the query and get the result list.
     $db->setQuery($query);
     $items = $db->loadObjectlist();
     // 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,代码行数:32,代码来源:fieldsql.php

示例4: onUserTwofactorShowConfiguration

 /**
  * Shows the configuration page for this two factor authentication method.
  *
  * @param   object   $otpConfig  The two factor auth configuration object
  * @param   integer  $user_id    The numeric user ID of the user whose form we'll display
  *
  * @return  boolean|string  False if the method is not ours, the HTML of the configuration page otherwise
  *
  * @see     UsersModelUser::getOtpConfig
  * @since   3.2
  */
 public function onUserTwofactorShowConfiguration($otpConfig, $user_id = null)
 {
     if ($otpConfig->method == $this->methodName) {
         // This method is already activated. Reuse the same Yubikey ID.
         $yubikey = $otpConfig->config['yubikey'];
     } else {
         // This methods is not activated yet. We'll need a Yubikey TOTP to setup this Yubikey.
         $yubikey = '';
     }
     // Is this a new TOTP setup? If so, we'll have to show the code validation field.
     $new_totp = $otpConfig->method != $this->methodName;
     // Start output buffering
     @ob_start();
     // Include the form.php from a template override. If none is found use the default.
     $path = FOFPlatform::getInstance()->getTemplateOverridePath('plg_twofactorauth_yubikey', true);
     JLoader::import('joomla.filesystem.file');
     if (JFile::exists($path . '/form.php')) {
         include_once $path . '/form.php';
     } else {
         include_once __DIR__ . '/tmpl/form.php';
     }
     // Stop output buffering and get the form contents
     $html = @ob_get_clean();
     // Return the form contents
     return array('method' => $this->methodName, 'form' => $html);
 }
开发者ID:joomla-projects,项目名称:media-manager-improvement,代码行数:37,代码来源:yubikey.php

示例5: checkout

 /**
  * Checks out the current item
  *
  * @return  boolean
  */
 public function checkout()
 {
     $table = $this->getTable($this->table);
     $status = $table->checkout(FOFPlatform::getInstance()->getUser()->id, $this->id);
     if (!$status) {
         $this->setError($table->getError());
     }
     return $status;
 }
开发者ID:julienV,项目名称:Joomla-Tracks,代码行数:14,代码来源:individualedits.php

示例6: getOptions

 /**
  * Method to get a list of tags
  *
  * @return  array  The field option objects.
  *
  * @since   3.1
  */
 protected function getOptions()
 {
     $options = array();
     $published = $this->element['published'] ? $this->element['published'] : array(0, 1);
     $db = FOFPlatform::getInstance()->getDbo();
     $query = $db->getQuery(true)->select('a.id AS value, a.path, a.title AS text, a.level, a.published')->from('#__tags AS a')->join('LEFT', $db->quoteName('#__tags') . ' AS b ON a.lft > b.lft AND a.rgt < b.rgt');
     if ($this->item instanceof FOFTable) {
         $item = $this->item;
     } else {
         $item = $this->form->getModel()->getItem();
     }
     if ($item instanceof FOFTable) {
         // Fake value for selected tags
         $keyfield = $item->getKeyName();
         $content_id = $item->{$keyfield};
         $type = $item->getContentType();
         $selected_query = $db->getQuery(true);
         $selected_query->select('tag_id')->from('#__contentitem_tag_map')->where('content_item_id = ' . (int) $content_id)->where('type_alias = ' . $db->quote($type));
         $db->setQuery($selected_query);
         $this->value = $db->loadColumn();
     }
     // Ajax tag only loads assigned values
     if (!$this->isNested()) {
         // Only item assigned values
         $values = (array) $this->value;
         FOFUtilsArray::toInteger($values);
         $query->where('a.id IN (' . implode(',', $values) . ')');
     }
     // Filter language
     if (!empty($this->element['language'])) {
         $query->where('a.language = ' . $db->quote($this->element['language']));
     }
     $query->where($db->quoteName('a.alias') . ' <> ' . $db->quote('root'));
     // Filter to only load active items
     // Filter on the published state
     if (is_numeric($published)) {
         $query->where('a.published = ' . (int) $published);
     } elseif (is_array($published)) {
         FOFUtilsArray::toInteger($published);
         $query->where('a.published IN (' . implode(',', $published) . ')');
     }
     $query->group('a.id, a.title, a.level, a.lft, a.rgt, a.parent_id, a.published, a.path')->order('a.lft ASC');
     // Get the options.
     $db->setQuery($query);
     try {
         $options = $db->loadObjectList();
     } catch (RuntimeException $e) {
         return false;
     }
     // Prepare nested data
     if ($this->isNested()) {
         $this->prepareOptionsNested($options);
     } else {
         $options = JHelperTags::convertPathsToNames($options);
     }
     return $options;
 }
开发者ID:deenison,项目名称:joomla-cms,代码行数:64,代码来源:tag.php

示例7:

 /**
  * Returns a new database query class
  *
  * @param   JDatabaseDriver  $db  The DB driver which will provide us with a query object
  *
  * @return FOFQueryAbstract
  */
 public static function &getNew($db = null)
 {
     FOFPlatform::getInstance()->logDeprecated('FOFQueryAbstract is deprecated. Use JDatabaseQuery instead.');
     if (is_null($db)) {
         $ret = FOFPlatform::getInstance()->getDbo()->getQuery(true);
     } else {
         $ret = $db->getQuery(true);
     }
     return $ret;
 }
开发者ID:naka211,项目名称:studiekorrektur,代码行数:17,代码来源:abstract.php

示例8: getOptions

 /**
  * Create objects for the options
  *
  * @return  array  The array of option objects
  */
 protected function getOptions()
 {
     $options = array();
     // Get the field $options
     foreach ($this->element->children() as $option) {
         // Only add <option /> elements.
         if ($option->getName() != 'option') {
             continue;
         }
         // Create a new option object based on the <option /> element.
         $options[] = JHtml::_('select.option', (string) $option['value'], JText::alt(trim((string) $option), preg_replace('/[^a-zA-Z0-9_\\-]/', '_', $this->fieldname)), 'value', 'text', (string) $option['disabled'] == 'true');
     }
     // Do we have a class and method source for our options?
     $source_file = empty($this->element['source_file']) ? '' : (string) $this->element['source_file'];
     $source_class = empty($this->element['source_class']) ? '' : (string) $this->element['source_class'];
     $source_method = empty($this->element['source_method']) ? '' : (string) $this->element['source_method'];
     $source_key = empty($this->element['source_key']) ? '*' : (string) $this->element['source_key'];
     $source_value = empty($this->element['source_value']) ? '*' : (string) $this->element['source_value'];
     $source_translate = empty($this->element['source_translate']) ? 'true' : (string) $this->element['source_translate'];
     $source_translate = in_array(strtolower($source_translate), array('true', 'yes', '1', 'on')) ? true : false;
     $source_format = empty($this->element['source_format']) ? '' : (string) $this->element['source_format'];
     if ($source_class && $source_method) {
         // Maybe we have to load a file?
         if (!empty($source_file)) {
             $source_file = FOFTemplateUtils::parsePath($source_file, true);
             if (FOFPlatform::getInstance()->getIntegrationObject('filesystem')->fileExists($source_file)) {
                 include_once $source_file;
             }
         }
         // Make sure the class exists
         if (class_exists($source_class, true)) {
             // ...and so does the option
             if (in_array($source_method, get_class_methods($source_class))) {
                 // Get the data from the class
                 if ($source_format == 'optionsobject') {
                     $options = array_merge($options, $source_class::$source_method());
                 } else {
                     $source_data = $source_class::$source_method();
                     // Loop through the data and prime the $options array
                     foreach ($source_data as $k => $v) {
                         $key = empty($source_key) || $source_key == '*' ? $k : $v[$source_key];
                         $value = empty($source_value) || $source_value == '*' ? $v : $v[$source_value];
                         if ($source_translate) {
                             $value = JText::_($value);
                         }
                         $options[] = JHtml::_('select.option', $key, $value, 'value', 'text');
                     }
                 }
             }
         }
     }
     reset($options);
     return $options;
 }
开发者ID:joomla-projects,项目名称:media-manager-improvement,代码行数:59,代码来源:fieldselectable.php

示例9: preRender

 /**
  * Runs before rendering the view template, echoing HTML to put before the
  * view template's generated HTML
  *
  * @return void
  */
 protected function preRender()
 {
     $view = $this->input->getCmd('view', 'cpanel');
     $task = $this->getModel()->getState('task', 'browse');
     // Don't load the toolbar on CLI
     if (!FOFPlatform::getInstance()->isCli()) {
         $toolbar = FOFToolbar::getAnInstance($this->input->getCmd('option', 'com_foobar'), $this->config);
         $toolbar->perms = $this->perms;
         $toolbar->renderToolbar($view, $task, $this->input);
     }
     $renderer = $this->getRenderer();
     $renderer->preRender($view, $task, $this->input, $this->config);
 }
开发者ID:WineWorld,项目名称:joomlatrialcmbg,代码行数:19,代码来源:html.php

示例10: getOptions

 /**
  * Method to get the list of access levels
  *
  * @return  array	A list of access levels.
  *
  * @since   2.0
  */
 protected function getOptions()
 {
     $db = FOFPlatform::getInstance()->getDbo();
     $query = $db->getQuery(true);
     $query->select('a.id AS value, a.title AS text');
     $query->from('#__viewlevels AS a');
     $query->group('a.id, a.title, a.ordering');
     $query->order('a.ordering ASC');
     $query->order($query->qn('title') . ' ASC');
     // Get the options.
     $db->setQuery($query);
     $options = $db->loadObjectList();
     return $options;
 }
开发者ID:joshjim27,项目名称:jobsglobal,代码行数:21,代码来源:accesslevel.php

示例11: getForm

 /**
  * Retrieves the two factor plugin forms
  *
  * @since	1.3
  * @access	public
  * @param	string
  * @return
  */
 public static function getForm($userId = '')
 {
     FOFPlatform::getInstance()->importPlugin('twofactorauth');
     if (!$userId) {
         $otpConfig = new stdClass();
         $otpConfig->method = 'none';
         $otpConfig->config = array();
         $otpConfig->otep = array();
     } else {
         $user = FD::user($userId);
         $otpConfig = $user->getOtpConfig();
     }
     return FOFPlatform::getInstance()->runPlugins('onUserTwofactorShowConfiguration', array($otpConfig, $userId));
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:22,代码来源:helper.php

示例12: onAfterGetItem

 /**
  * The event runs after FOFModel has called FOFTable and retrieved a single
  * item from the database. It is used to apply automatic filters.
  *
  * @param   FOFModel  &$model   The model which was called
  * @param   FOFTable  &$record  The record loaded from the databae
  *
  * @return  void
  */
 public function onAfterGetItem(&$model, &$record)
 {
     if ($record instanceof FOFTable) {
         $fieldName = $record->getColumnAlias('created_by');
         // Make sure the field actually exists
         if (!in_array($fieldName, $record->getKnownFields())) {
             return;
         }
         $user_id = FOFPlatform::getInstance()->getUser()->id;
         if ($record->{$fieldName} != $user_id) {
             $record = null;
         }
     }
 }
开发者ID:shoffmann52,项目名称:install-from-web-server,代码行数:23,代码来源:private.php

示例13: buildQuery

 public function buildQuery($overrideLimits = false)
 {
     $table = $this->getTable();
     $tableName = $table->getTableName();
     $tableKey = $table->getKeyName();
     $db = $this->getDbo();
     $query = $db->getQuery(true);
     // Call the behaviors
     $this->modelDispatcher->trigger('onBeforeBuildQuery', array(&$this, &$query));
     $alias = $this->getTableAlias();
     if ($alias) {
         $alias = ' AS ' . $db->qn($alias);
     } else {
         $alias = '';
     }
     $select = $this->getTableAlias() ? $db->qn($this->getTableAlias()) . '.*' : $db->qn($tableName) . '.*';
     $query->select($select)->from($db->qn($tableName) . $alias);
     //Frontend
     if (FOFPlatform::getInstance()->isFrontend()) {
         //Enabled
         $query->where($db->qn('enabled') . " = " . $db->quote('1'));
         //Access
         $query->where($db->quoteName('access') . " IN (" . implode(',', JFactory::getUser()->getAuthorisedViewLevels()) . ")");
     }
     if (!$overrideLimits) {
         if (FOFPlatform::getInstance()->isFrontend()) {
             $order = 'ordering';
         } else {
             $order = $this->getState('filter_order', null, 'cmd');
         }
         if (!in_array($order, array_keys($table->getData()))) {
             $order = $tableKey;
         }
         $order = $db->qn($order);
         if ($alias) {
             $order = $db->qn($this->getTableAlias()) . '.' . $order;
         }
         if (FOFPlatform::getInstance()->isFrontend()) {
             $dir = 'ASC';
         } else {
             $dir = $this->getState('filter_order_Dir', 'ASC', 'cmd');
         }
         $query->order($order . ' ' . $dir);
     }
     // Call the behaviors
     $this->modelDispatcher->trigger('onAfterBuildQuery', array(&$this, &$query));
     return $query;
 }
开发者ID:ranrolls,项目名称:ras-full-portal,代码行数:48,代码来源:items.php

示例14: onAfterGetItem

 /**
  * The event runs after FOFModel has called FOFTable and retrieved a single
  * item from the database. It is used to apply automatic filters.
  *
  * @param   FOFModel  &$model   The model which was called
  * @param   FOFTable  &$record  The record loaded from the databae
  *
  * @return  void
  */
 public function onAfterGetItem(&$model, &$record)
 {
     if ($record instanceof FOFTable) {
         $fieldName = $record->getColumnAlias('access');
         // Make sure the field actually exists
         if (!in_array($fieldName, $record->getKnownFields())) {
             return;
         }
         // Get the user
         $user = FOFPlatform::getInstance()->getUser();
         // Filter by authorised access levels
         if (!in_array($record->{$fieldName}, $user->getAuthorisedViewLevels())) {
             $record = null;
         }
     }
 }
开发者ID:01J,项目名称:skazkipronebo,代码行数:25,代码来源:access.php

示例15: onAfterBuildQuery

 /**
  * This event runs after we have built the query used to fetch a record
  * list in a model. It is used to apply automatic query filters.
  *
  * @param   FOFModel        &$model  The model which calls this event
  * @param   JDatabaseQuery  &$query  The model which calls this event
  *
  * @return  void
  */
 public function onAfterBuildQuery(&$model, &$query)
 {
     // This behavior only applies to the front-end.
     if (!FOFPlatform::getInstance()->isFrontend()) {
         return;
     }
     // Get the name of the enabled field
     $table = $model->getTable();
     $enabledField = $table->getColumnAlias('enabled');
     // Make sure the field actually exists
     if (!in_array($enabledField, $table->getKnownFields())) {
         return;
     }
     // Filter by enabled fields only
     $db = FOFPlatform::getInstance()->getDbo();
     $query->where($db->qn($enabledField) . ' = ' . $db->q(1));
 }
开发者ID:WineWorld,项目名称:joomlatrialcmbg,代码行数:26,代码来源:enabled.php


注:本文中的FOFPlatform类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。