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


PHP JTable类代码示例

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


在下文中一共展示了JTable类的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: 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


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