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


PHP JTable::getInstance方法代码示例

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


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

示例1: save

 function save()
 {
     $mainframe =& JFactory::getApplication();
     $row =& JTable::getInstance('K2UserGroup', 'Table');
     if (!$row->bind(JRequest::get('post'))) {
         $mainframe->redirect('index.php?option=com_k2&view=userGroups', $row->getError(), 'error');
     }
     if (!$row->check()) {
         $mainframe->redirect('index.php?option=com_k2&view=userGroup&cid=' . $row->id, $row->getError(), 'error');
     }
     if (!$row->store()) {
         $mainframe->redirect('index.php?option=com_k2&view=userGroups', $row->getError(), 'error');
     }
     $cache =& JFactory::getCache('com_k2');
     $cache->clean();
     switch (JRequest::getCmd('task')) {
         case 'apply':
             $msg = JText::_('Changes to User Group saved');
             $link = 'index.php?option=com_k2&view=userGroup&cid=' . $row->id;
             break;
         case 'save':
         default:
             $msg = JText::_('User Group Saved');
             $link = 'index.php?option=com_k2&view=userGroups';
             break;
     }
     $mainframe->redirect($link, $msg);
 }
开发者ID:navinpai,项目名称:GEC-Tandav,代码行数:28,代码来源:usergroup.php

示例2: move

 /**
  * Logic to move
  */
 function move()
 {
     // Check for request forgeries
     JRequest::checkToken() or jexit('Invalid Token');
     // Get the table instance
     $row =& JTable::getInstance('RSMembership_Extras', 'Table');
     // Get the selected items
     $cid = JRequest::getVar('cid', array(0), 'post', 'array');
     // Get the task
     $task = JRequest::getCmd('task');
     // Force array elements to be integers
     JArrayHelper::toInteger($cid, array(0));
     // Set the direction to move
     $direction = $task == 'orderup' ? -1 : 1;
     // Can move only one element
     if (is_array($cid)) {
         $cid = $cid[0];
     }
     // Load row
     if (!$row->load($cid)) {
         $this->setError($this->_db->getErrorMsg());
         return false;
     }
     // Move
     $row->move($direction);
     // Redirect
     $this->setRedirect('index.php?option=com_rsmembership&view=extras');
 }
开发者ID:atikahmed,项目名称:joomla-probid,代码行数:31,代码来源:extras.php

示例3: _getAllEvents

 private function _getAllEvents()
 {
     $mainframe = JFactory::getApplication();
     $rows = $this->model->getEvents();
     $items = array();
     foreach ($rows as $row) {
         $item = new stdClass();
         $table =& JTable::getInstance('Event', 'CTable');
         $table->bind($row);
         $table->thumbnail = $table->getThumbAvatar();
         $table->avatar = $table->getAvatar();
         $author = CFactory::getUser($table->creator);
         $item->id = $row->id;
         $item->created = $row->created;
         $item->creator = CStringHelper::escape($author->getDisplayname());
         $item->title = $row->title;
         $item->description = CStringHelper::escape($row->description);
         $item->location = CStringHelper::escape($row->location);
         $tiem->startdate = $row->startdate;
         $item->enddate = $row->enddate;
         $item->thumbnail = $table->thumbnail;
         $tiem->avatar = $table->avatar;
         $item->ticket = $row->ticket;
         $item->invited = $row->invitedcount;
         $item->confirmed = $row->confirmedcount;
         $item->declined = $row->declinedcount;
         $item->maybe = $row->maybecount;
         $item->latitude = $row->latitude;
         $item->longitude = $row->longitude;
         $items[] = $item;
     }
     return $items;
 }
开发者ID:bizanto,项目名称:Hooked,代码行数:33,代码来源:view.raw.php

示例4: __construct

 public function __construct($contentElement)
 {
     $this->filterNullValue = -1;
     $this->filterType = "category";
     $this->filterField = $contentElement->getFilter("category");
     parent::__construct($contentElement);
     // if currently selected category is not compatible with section then reset
     if (intval(JRequest::getVar('filter_reset', 0))) {
         $this->section_filter_value = -1;
     } else {
         if ($this->rememberValues) {
             $this->section_filter_value = JFactory::getApplication()->getUserStateFromRequest('section_filter_value', 'section_filter_value', -1);
         } else {
             $this->section_filter_value = JRequest::getVar("section_filter_value", -1);
         }
     }
     if ($this->section_filter_value != -1 and $this->filter_value >= 0) {
         $cat = JTable::getInstance('category');
         $cat->load($this->filter_value);
         if ($cat->section != $this->section_filter_value) {
             $this->filter_value = -1;
         }
     }
     if ($this->section_filter_value == 0) {
         $this->filter_value = 0;
     }
 }
开发者ID:jmangarret,项目名称:webtuagencia24,代码行数:27,代码来源:category.php

示例5: store

 public function store($updateNulls = true)
 {
     $date = JFactory::getDate();
     $user = JFactory::getUser();
     if ($this->id) {
         $this->modified_time = $date->toSql();
         $this->modified_user_id = $user->get('id');
     } else {
         if (!(int) $this->created_time) {
             $this->created_time = $date->toSql();
         }
         if (empty($this->created_user_id)) {
             $this->created_user_id = $user->get('id');
         }
     }
     $table = JTable::getInstance('Page', 'SppagebuilderTable');
     $alias = JFilterOutput::stringURLSafe($this->alias);
     if ($alias == '') {
         $alias = JFilterOutput::stringURLSafe($this->title);
     }
     $this->alias = $alias;
     if ($table->load(array('alias' => $alias)) && ($table->id != $this->id || $this->id == 0)) {
         $this->setError(JText::_('COM_SPPAGEBUILDER_ERROR_UNIQUE_ALIAS'));
         return false;
     }
     return parent::store($updateNulls);
 }
开发者ID:spikart,项目名称:spikart.com.ua,代码行数:27,代码来源:page.php

示例6: getInfo

 /**
 	get field value of $userId accordimg to $fieldCode
 */
 public function getInfo($userId, $fieldCode)
 {
     // Run Query to return 1 value
     $db = JFactory::getDBO();
     $query = 'SELECT b.* FROM ' . $db->nameQuote('#__community_fields') . ' AS a ' . 'INNER JOIN ' . $db->nameQuote('#__community_fields_values') . ' AS b ' . 'ON b.' . $db->nameQuote('field_id') . '=a.' . $db->nameQuote('id') . ' ' . 'AND b.' . $db->nameQuote('user_id') . '=' . $db->Quote($userId) . ' ' . 'INNER JOIN ' . $db->nameQuote('#__community_users') . ' AS c ' . 'ON c.' . $db->nameQuote('userid') . '= b.' . $db->nameQuote('user_id') . 'WHERE a.' . $db->nameQuote('fieldcode') . ' =' . $db->Quote($fieldCode);
     $db->setQuery($query);
     $result = $db->loadObject();
     $field = JTable::getInstance('FieldValue', 'CTable');
     $field->bind($result);
     if ($db->getErrorNum()) {
         JError::raiseError(500, $db->stderr());
     }
     $config = CFactory::getConfig();
     // @rule: Only trigger 3rd party apps whenever they override extendeduserinfo configs
     if ($config->getBool('extendeduserinfo')) {
         CFactory::load('libraries', 'apps');
         $apps = CAppPlugins::getInstance();
         $apps->loadApplications();
         $params = array();
         $params[] = $fieldCode;
         $params[] =& $field->value;
         $apps->triggerEvent('onGetUserInfo', $params);
     }
     // Respect privacy settings.
     if (!XIPT_JOOMLA_15) {
         $my = CFactory::getUser();
         CFactory::load('libraries', 'privacy');
         if (!CPrivacy::isAccessAllowed($my->id, $userId, 'custom', $field->access)) {
             return false;
         }
     }
     return $field->value;
 }
开发者ID:Simarpreet05,项目名称:joomla,代码行数:36,代码来源:utils.php

示例7: publish

 function publish()
 {
     //      global $option;
     $cid = JRequest::getVar('cid', array());
     $row = JTable::getInstance('twines', 'Table');
     $publish = 1;
     if ($this->getTask() == 'unpublish') {
         $publish = 0;
     }
     if (!$row->publish($cid, $publish)) {
         JError::raiseError(500, $row->getError());
     }
     $s = '';
     if (count($cid) > 1) {
         $s = 's';
     }
     $msg = 'Page' . $s;
     if ($this->getTask() == 'unpublish') {
         $msg .= ' unpublished';
     } else {
         $msg .= ' published';
     }
     // $this->setRedirect('index.php?option=' . $option, $msg);
     $this->setRedirect('index.php?option=com_battle&view=twines', $msg);
 }
开发者ID:yatan,项目名称:JiGS-PHP-RPG-engine,代码行数:25,代码来源:twines.php

示例8: postData

 /**
  * Post data from JSON resource item.
  *
  * @param   string	$data  The JSON+HAL resource.
  *
  * @return bool True if resource is created, false if some error occured
  */
 public function postData($data, $tableClass = false, $tablePrefix = 'JTable', $tablePath = array())
 {
     // Declare return
     $return = false;
     // Get the database query object.
     $query = $this->db->getQuery(true);
     // Get a database query helper object.
     $apiQuery = $this->getApiQuery();
     // Get the correct table class
     $tableClass = $tableClass != false ? $this->tableClass : $tableClass;
     // Get the correct table prefix
     $tablePrefix = $tablePrefix != 'JTable' ? $tablePrefix : 'JTable';
     // Include the legacy table classes
     JTable::addIncludePath(JPATH_LIBRARIES . '/legacy/table/');
     // Include the custom table path if exists
     if (count($tablePath)) {
         foreach ($tablePath as $path) {
             JTable::addIncludePath($path);
         }
     }
     // Declare the JTable class
     $table = JTable::getInstance($tableClass, $tablePrefix, array('dbo' => $this->db));
     try {
         $return = $apiQuery->postItem($query, $table, $data);
     } catch (Exception $e) {
         $this->app->setHeader('status', '400', true);
         // An exception has been caught, echo the message and exit.
         echo json_encode(array('message' => $e->getMessage(), 'code' => $e->getCode(), 'type' => get_class($e)));
         exit;
     }
     return $return;
 }
开发者ID:klas,项目名称:matware-libraries,代码行数:39,代码来源:item.php

示例9:

 /**
  * Method to get an ojbect.
  *
  * @param	integer	The id of the object to get.
  *
  * @return	mixed	Object on success, false on failure.
  */
 public function &getItem($id = null)
 {
     if ($this->_item === null) {
         $this->_item = false;
         if (empty($id)) {
             $id = $this->getState('weblink.id');
         }
         // Get a level row instance.
         $table = JTable::getInstance('Weblink', 'WeblinksTable');
         // Attempt to load the row.
         if ($table->load($id)) {
             // Check published state.
             if ($published = $this->getState('filter.published')) {
                 if ($table->state != $published) {
                     return $this->_item;
                 }
             }
             // Convert the JTable to a clean JObject.
             $properties = $table->getProperties(1);
             $this->_item = JArrayHelper::toObject($properties, 'JObject');
         } else {
             if ($error = $table->getError()) {
                 $this->setError($error);
             }
         }
     }
     return $this->_item;
 }
开发者ID:akksi,项目名称:jcg,代码行数:35,代码来源:weblink.php

示例10: getCategory

 function getCategory()
 {
     $category_id = $this->category_id;
     $row =& JTable::getInstance('RSTicketsPro_KB_Categories', 'Table');
     $row->load($category_id);
     $cat =& JTable::getInstance('RSTicketsPro_KB_Categories', 'Table');
     if ($row->parent_id) {
         $parent_id = $row->parent_id;
         $cat->load($parent_id);
         while ($parent_id > 0) {
             $parent_id = $cat->parent_id;
             $cat->load($parent_id);
             if ($cat->private) {
                 $row->private = 1;
             }
             if (!$cat->published) {
                 $row->published = 0;
             }
         }
     }
     if (!$this->is_staff && $row->private || !$row->published) {
         $mainframe =& JFactory::getApplication();
         JError::raiseWarning(500, JText::_('RST_CANNOT_VIEW_CATEGORY'));
         $mainframe->redirect('index.php?option=com_rsticketspro&view=knowledgebase');
     }
     $document =& JFactory::getDocument();
     if (!empty($row->meta_description)) {
         $document->setMetaData('description', $row->meta_description);
     }
     if (!empty($row->meta_keywords)) {
         $document->setMetaData('keywords', $row->meta_keywords);
     }
     return $row;
 }
开发者ID:atikahmed,项目名称:joomla-probid,代码行数:34,代码来源:knowledgebase.php

示例11: getItem

 /**
  * Method to get a version history row.
  *
  * @return  stdClass|boolean    On success, standard object with row data. False on failure.
  *
  * @since   3.2
  */
 public function getItem()
 {
     /** @var JTableContenthistory $table */
     $table = JTable::getInstance('Contenthistory');
     $versionId = JFactory::getApplication()->input->getInt('version_id');
     if (!$table->load($versionId)) {
         return false;
     }
     // Get the content type's record so we can check ACL
     /** @var JTableContenttype $contentTypeTable */
     $contentTypeTable = JTable::getInstance('Contenttype');
     if (!$contentTypeTable->load($table->ucm_type_id)) {
         // Assume a failure to load the content type means broken data, abort mission
         return false;
     }
     // Access check
     if (!JFactory::getUser()->authorise('core.edit', $contentTypeTable->type_alias . '.' . (int) $table->ucm_item_id)) {
         $this->setError(JText::_('JERROR_ALERTNOAUTHOR'));
         return false;
     }
     // Good to go, finish processing the data
     $result = new stdClass();
     $result->save_date = $table->save_date;
     $result->version_note = $table->version_note;
     $result->data = ContenthistoryHelper::prepareData($table);
     return $result;
 }
开发者ID:edwardmagbago,项目名称:joomlatools-platform-content,代码行数:34,代码来源:preview.php

示例12: store

 public function store($updateNulls = false)
 {
     $date = JFactory::getDate();
     $user = JFactory::getUser();
     $app = JFactory::getApplication();
     $db = JFactory::getDbo();
     if (!$this->id) {
         if (!intval($this->created)) {
             $this->created = $date->toSql();
         }
         if (empty($this->created_by)) {
             $this->created_by = $user->get('id');
         }
     }
     $table = JTable::getInstance('Producers', 'Djcatalog2Table');
     if ($app->isSite() || $app->input->get('task') == 'import') {
         if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) {
             $db->setQuery('select alias from #__djc2_producers where id != ' . $this->id . ' and alias like ' . $db->quote($db->escape($this->alias) . '%') . ' order by alias asc');
             $aliases = $db->loadColumn();
             $suffix = 2;
             while (in_array($this->alias . '-' . $suffix, $aliases)) {
                 $suffix++;
             }
             $this->alias = $this->alias . '-' . $suffix;
         }
     } else {
         if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) {
             $this->setError(JText::_('COM_DJCATALOG2_ERROR_UNIQUE_ALIAS'));
             return false;
         }
     }
     return parent::store($updateNulls);
 }
开发者ID:ForAEdesWeb,项目名称:AEW4,代码行数:33,代码来源:producers.php

示例13: rss

 function rss()
 {
     $mainframe = JFactory::getApplication();
     require_once JPATH_COMPONENT . DS . 'helpers' . DS . 'feedcreator.class.php';
     $alias = JRequest::getVar('alias', NULL);
     $model = $this->getModel();
     $model_items = JAVBModel::getInstance('items', 'javoiceModel');
     $feed = JTable::getInstance('feeds', 'Table');
     if (!$alias) {
         $post = JRequest::get('request', JREQUEST_ALLOWHTML);
         $post['feed_name'] = isset($post['feed_name']) ? $post['feed_name'] : JText::_("NO_NAME");
         $feed->bind($post);
     } else {
         $feeds = $model->getItems(" AND f.feed_alias='{$alias}'");
         if (!$feeds) {
             $mainframe->redirect(JRoute::_("index.php?option=com_javoice&view=feeds&layout=guide"), JText::_("NOT_FOUND_RSS"));
             return FALSE;
         }
         $feed->bind($feeds[0]);
     }
     //print_r($feed);exit;
     $where = $model->getWhereClause($feed);
     $document = JFactory::getDocument();
     $document->setTitle($feed->feed_name);
     $limit = 20;
     if ($feed->msg_count > 0) {
         $limit = $feed->msg_count;
     }
     $joins = " INNER JOIN #__jav_voice_type_status as s ON s.id=i.voice_type_status_id ";
     $items = $model_items->getItems($where, '', 0, $limit, '', $joins);
     $content = $model->getContentRss($feed, $items);
     $this->assignRef('feed', $feed);
     $this->assignRef('content', $content);
     return TRUE;
 }
开发者ID:jomsocial,项目名称:JSVoice,代码行数:35,代码来源:view.html.php

示例14: addAddress

 function addAddress($type = 'billing', $data = array())
 {
     $app = JFactory::getApplication();
     $db = JFactory::getDBO();
     $user = JFactory::getUser();
     if (isset($data) && count($data)) {
         $post = $data;
     } else {
         $post = $app->input->getArray($_POST);
     }
     foreach ($post as $key => $value) {
         //in case the value is an array, store as a json encoded message
         if (is_array($value)) {
             $post[$key] = $db->escape(json_encode($value));
         }
     }
     //first save data to the address table
     $row = JTable::getInstance('Address', 'Table');
     //set the id so that it updates the record rather than changing
     if (!$row->bind($post)) {
         $this->setError($row->getError());
         return false;
     }
     if ($user->id) {
         $row->user_id = $user->id;
     }
     $row->type = $type;
     if (!$row->store()) {
         $this->setError($row->getError());
         return false;
     }
     return $row->id;
 }
开发者ID:A-Bush,项目名称:pprod,代码行数:33,代码来源:address.php

示例15: execute

 public function execute($language, $start = 0, $limit = 100)
 {
     $db = JFactory::getDBO();
     $source = $this->getCode();
     $query = $db->getQuery(true);
     $query->select('c.*');
     $query->from($db->quoteName($this->tableName) . ' AS c');
     $query->select('u.username as user_username, u.name as user_name, u.email as user_email');
     $query->join('LEFT', $db->quoteName('#__users') . ' AS u ON c.userid = u.id');
     $query->order($db->escape('c.date'));
     $db->setQuery($query, $start, $limit);
     $rows = $db->loadObjectList();
     foreach ($rows as $row) {
         $table = JTable::getInstance('Comment', 'JCommentsTable');
         $table->object_id = $row->contentid;
         $table->object_group = $row->option;
         $table->parent = $row->parentid;
         $table->userid = $row->userid;
         $table->name = $row->name;
         $table->username = $row->username;
         $table->comment = $row->comment;
         $table->ip = $row->ip;
         $table->email = $row->email;
         $table->homepage = $row->website;
         $table->published = $row->published;
         $table->date = $row->date;
         $table->isgood = $row->voted > 0 ? $row->voted : 0;
         $table->ispoor = $row->voted < 0 ? abs($row->voted) : 0;
         $table->lang = $language;
         $table->source_id = $row->id;
         $table->source = $source;
         $table->store();
     }
 }
开发者ID:ForAEdesWeb,项目名称:AEW2,代码行数:34,代码来源:jacomment.php


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