• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP JTable类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



在下文中一共展示了JTable类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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: prepareTable

 /**
  * Prepare and sanitise the table data prior to saving.
  *
  * @param   JTable  $table  A reference to a JTable object.
  *
  * @return  void
  *
  * @since   12.2
  */
 protected function prepareTable($table)
 {
     require_once JDeveloperLIB . "/template.php";
     $type = $table->get("type", "");
     $dir = JDeveloperTEMPLATES . "/fields/formfields/" . $type . ".php";
     if ($table->id == 0 && JFile::exists($dir)) {
         $template = new JDeveloperTemplate($dir);
         $template->addAreas(array("header" => false));
         $template->addPlaceholders(array("name" => $table->name), true);
         $table->source = $template->getBuffer();
     }
 }
开发者ID:joshjim27,项目名称:jobsglobal,代码行数:21,代码来源:formfield.php


示例3: 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


示例4: 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


示例5: _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


示例6: __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


示例7: postflight

 public function postflight($action, $adapter)
 {
     $table = JTable::getInstance('extension');
     $component = "com_jevents";
     if (!$table->load(array("element" => "com_jevents", "type" => "component"))) {
         JFactory::getApplication()->enqueueMessage('Not a valid component', 'error');
         return false;
     }
     $params = JComponentHelper::getParams("com_jevents");
     $checkClashes = $params->get("checkclashes", 0);
     if ($params->get("noclashes", 0)) {
         $params->set("checkconflicts", "2");
     } else {
         if ($params->get("checkclashes", 0)) {
             $params->set("checkconflicts", "1");
         }
     }
     $paramsArray = $params->toArray();
     unset($paramsArray['checkclashes']);
     unset($paramsArray['noclashes']);
     $post['params'] = $paramsArray;
     $post['option'] = $component;
     $table->bind($post);
     // pre-save checks
     if (!$table->check()) {
         JFactory::getApplication()->enqueueMessage($table->getError(), 'error');
         return false;
     }
     // save the changes
     if (!$table->store()) {
         JFactory::getApplication()->enqueueMessage($table->getError(), 'error');
         return false;
     }
     return true;
 }
开发者ID:pguilford,项目名称:vcomcc,代码行数:35,代码来源:install.php


示例8: bind

 /**
  * Overloaded bind function
  *
  * @acces public
  * @param array $hash named array
  * @return null|string	null is operation was satisfactory, otherwise returns an error
  * @see JTable:bind
  * @since 1.5
  */
 public function bind($array, $ignore = '')
 {
     if (isset($array['params']) && is_array($array['params'])) {
         $array['params'] = json_encode($array['params']);
     }
     return parent::bind($array, $ignore);
 }
开发者ID:madcsaba,项目名称:li-de,代码行数:16,代码来源:modules.php


示例9: save

 public function save()
 {
     $app = JFactory::getApplication();
     $model = $this->getModel('promotion');
     $row =& JTable::getInstance('Promotions', 'DJClassifiedsTable');
     $par =& JComponentHelper::getParams('com_djclassifieds');
     if (!$row->bind(JRequest::get('post'))) {
         echo "<script> alert('" . $row->getError() . "');\n\t\t\t\twindow.history.go(-1); </script>\n";
         exit;
     }
     if (!$row->store()) {
         echo "<script> alert('" . $row->getError() . "');\n\t\t\t\twindow.history.go(-1); </script>\n";
         exit;
     }
     switch (JRequest::getVar('task')) {
         case 'apply':
             $link = 'index.php?option=com_djclassifieds&task=promotion.edit&id=' . $row->id;
             $msg = JText::_('COM_DJCLASSIFIEDS_PROMOTION_SAVED');
             break;
         case 'save2new':
             $link = 'index.php?option=com_djclassifieds&task=promotion.add';
             $msg = JText::_('COM_DJCLASSIFIEDS_PROMOTION_SAVED');
             break;
         case 'saveItem':
         default:
             $link = 'index.php?option=com_djclassifieds&view=promotions';
             $msg = JText::_('COM_DJCLASSIFIEDS_PROMOTION_SAVED');
             break;
     }
     $app->redirect($link, $msg);
 }
开发者ID:politik86,项目名称:test2,代码行数:31,代码来源:promotion.php


示例10: __construct

 /**
  * Constructor
  *
  * @param   JDatabaseDriver  $db  Database driver object.
  *
  * @since   11.1
  * @deprecated  13.3  Use SQL queries to interact with the session table.
  */
 public function __construct(JDatabaseDriver $db)
 {
     JLog::add('JTableSession is deprecated. Use SQL queries directly to interact with the session table.', JLog::WARNING, 'deprecated');
     parent::__construct('#__session', 'session_id', $db);
     $this->guest = 1;
     $this->username = '';
 }
开发者ID:adjaika,项目名称:J3Base,代码行数:15,代码来源:session.php


示例11: is_checkout

 function is_checkout($checked_out)
 {
     if ($this->user && JTable::isCheckedOut($this->user->get('id'), $checked_out)) {
         return true;
     }
     return false;
 }
开发者ID:omarmm,项目名称:MangLuoiBDS,代码行数:7,代码来源:view.html.php


示例12: store

 function store()
 {
     $row =& JTable::getInstance('contactus', 'Table');
     //$row =& $this->getTable();
     $data = JRequest::get('post');
     //print_r($data);
     //exit();
     if (!$row->bind($data)) {
         $this->setError($this->_db->getErrorMsg());
         return false;
     }
     // Make sure the hello record is valid
     if (!$row->check()) {
         $this->setError($this->_db->getErrorMsg());
         return false;
     }
     // Store the web link table to the database
     if (!$row->store()) {
         $this->setError($this->_db->getErrorMsg());
         return false;
     }
     //echo $this->_db->getErrorMsg();
     //exit();
     return true;
 }
开发者ID:hideaz2011,项目名称:Aspire-Fitness,代码行数:25,代码来源:contactus.php


示例13:

 function &getTable()
 {
     if ($this->_table == null) {
         $this->_table = JTable::getInstance('produsts', $this->getDBO());
     }
     return $this->_table;
 }
开发者ID:naka211,项目名称:designcreations1,代码行数:7,代码来源:products.php


示例14: getBasicInfo

 /**
  * Gets a users basic information
  *
  * @param int $userid
  * @return obj CitruscartAddresses if found, false otherwise
  */
 public static function getBasicInfo($userid)
 {
     JTable::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_citruscart/tables');
     $row = JTable::getInstance('UserInfo', 'CitruscartTable');
     $row->load(array('user_id' => $userid));
     return $row;
 }
开发者ID:joomlacorner,项目名称:citruscart,代码行数:13,代码来源:user.php


示例15: 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


示例16: _startElement

 /**
  * Start element parser callback.
  *
  * @param   object  $parser  The parser object.
  * @param   string  $name    The name of the element.
  * @param   array   $attrs   The attributes of the element.
  *
  * @return  void
  *
  * @since   11.1
  */
 protected function _startElement($parser, $name, $attrs = array())
 {
     array_push($this->stack, $name);
     $tag = $this->_getStackLocation();
     // Reset the data
     if (isset($this->{$tag})) {
         $this->{$tag}->_data = "";
     }
     switch ($name) {
         case 'UPDATE':
             $this->currentUpdate = JTable::getInstance('update');
             $this->currentUpdate->update_site_id = $this->updateSiteId;
             $this->currentUpdate->detailsurl = $this->_url;
             $this->currentUpdate->folder = "";
             $this->currentUpdate->client_id = 1;
             break;
             // Don't do anything
         // Don't do anything
         case 'UPDATES':
             break;
         default:
             if (in_array($name, $this->updatecols)) {
                 $name = strtolower($name);
                 $this->currentUpdate->{$name} = '';
             }
             if ($name == 'TARGETPLATFORM') {
                 $this->currentUpdate->targetplatform = $attrs;
             }
             if ($name == 'PHP_MINIMUM') {
                 $this->currentUpdate->php_minimum = '';
             }
             break;
     }
 }
开发者ID:JonatanLiecheski,项目名称:MeditecJoomla,代码行数:45,代码来源:extension.php


示例17: createCustomField

 function createCustomField($what)
 {
     // Load the JTable Object.
     JTable::addIncludePath(JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_community' . DS . 'tables');
     $row = JTable::getInstance('profiles', 'CommunityTable');
     $row->load(0);
     switch ($what) {
         case PROFILETYPE_CUSTOM_FIELD_CODE:
             $data['type'] = PROFILETYPE_FIELD_TYPE_NAME;
             $data['name'] = 'Profiletype';
             $data['tips'] = 'Profiletype Of User';
             break;
         case TEMPLATE_CUSTOM_FIELD_CODE:
             $data['type'] = TEMPLATE_FIELD_TYPE_NAME;
             $data['name'] = 'Template';
             $data['tips'] = 'Template Of User';
             break;
         default:
             XiptError::assert(0);
             break;
     }
     $data['published'] = 1;
     $data['fieldcode'] = $what;
     return $row->bind($data) && $row->store();
 }
开发者ID:Simarpreet05,项目名称:joomla,代码行数:25,代码来源:jsfields.php


示例18: 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.time'));
     $db->setQuery($query, $start, $limit);
     $rows = $db->loadObjectList();
     foreach ($rows as $row) {
         $table = JTable::getInstance('Comment', 'JCommentsTable');
         $table->object_id = $row->product_id;
         $table->object_group = 'com_virtuemart';
         $table->parent = 0;
         $table->userid = $row->userid;
         $table->name = $row->name;
         $table->username = $row->username;
         $table->comment = $row->comment;
         $table->email = $row->email;
         $table->published = $row->published;
         $table->date = strftime("%Y-%m-%d %H:%M:00", $row->time);
         $table->lang = $language;
         $table->source = $source;
         $table->store();
     }
 }
开发者ID:ForAEdesWeb,项目名称:AEW2,代码行数:29,代码来源:virtuemart.php


示例19: doExpiredSubscription

 /**
  * 
  * Enter description here ...
  * @param $subscription     mixed  CitruscartTableSubscriptions object or a subscription_id
  * @return unknown_type
  */
 function doExpiredSubscription($subscription)
 {
     if (is_numeric($subscription)) {
         JTable::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_citruscart/tables');
         $table = JTable::getInstance('Subscriptions', 'CitruscartTable');
         $table->load(array('subscription_id' => $subscription));
         $subscription = $table;
     }
     if (empty($subscription->subscription_id) || !is_object($subscription)) {
         $this->setError(JText::_('COM_CITRUSCART_JUGA_INVALID_SUBSCRIPTION'));
         return false;
     }
     if (!empty($subscription->product_id)) {
         JModelLegacy::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_citruscart/models');
         $model = JModelLegacy::getInstance('Products', 'CitruscartModel');
         $model->setId($subscription->product_id);
         $product = $model->getItem();
         $juga_group_csv_add = $product->product_parameters->get('juga_group_csv_add_expiration');
         $juga_group_csv_remove = $product->product_parameters->get('juga_group_csv_remove_expiration');
         $ids_remove = explode(',', $juga_group_csv_remove);
         if (!empty($ids_remove)) {
             foreach ($ids_remove as $id) {
                 $this->remove($subscription->user_id, $id);
             }
         }
         $ids_add = explode(',', $juga_group_csv_add);
         if (!empty($ids_add)) {
             foreach ($ids_add as $id) {
                 $this->add($subscription->user_id, $id);
             }
         }
     }
     return true;
 }
开发者ID:joomlacorner,项目名称:citruscart,代码行数:40,代码来源:juga.php


示例20: copy

 public function copy()
 {
     // Check for request forgeries
     JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
     $cid = $this->input->post->get('cid', array(), 'array');
     JTable::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_tagmeta/tables');
     $table =& JTable::getInstance('Rule', 'TagMetaTable');
     $n = count($cid);
     if ($n > 0) {
         $i = 0;
         foreach ($cid as $id) {
             if ($table->load((int) $id)) {
                 $table->id = 0;
                 $table->url = JText::_('COM_TAGMETA_COPY_OF') . $table->url;
                 $table->ordering = 0;
                 $table->published = false;
                 $table->checked_out = false;
                 if ($table->store()) {
                     $i++;
                 } else {
                     JFactory::getApplication()->enqueueMessage(JText::sprintf('COM_TAGMETA_COPY_ERROR_SAVING', $id, $table->getError()), 'error');
                 }
             } else {
                 JFactory::getApplication()->enqueueMessage(JText::sprintf('COM_TAGMETA_COPY_ERROR_LOADING', $id, $table->getError()), 'error');
             }
         }
     } else {
         return JError::raiseWarning(500, JText::_('COM_TAGMETA_COPY_ERROR_NO_SELECTION'));
     }
     $this->setMessage(JText::sprintf('COM_TAGMETA_COPY_OK', $i));
     $this->setRedirect('index.php?option=com_tagmeta&view=rules');
 }
开发者ID:ranrolls,项目名称:ras-full-portal,代码行数:32,代码来源:rules.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP JTableNested类代码示例发布时间:2022-05-23
下一篇:
PHP JTEXT类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap