コード例 #1
0
 /**
  * this is for the omnigrid table management
  *
  * @access public
  * @return boolean True on success
  */
 function getPageList()
 {
     if ($page = bRequest::getVar("page", 0)) {
         $page = true;
         $page = intval(bRequest::getVar("page"));
         $perpage = intval(bRequest::getVar("perpage"));
         $n = ($page - 1) * $perpage;
     }
     //setting pagination query
     $limit = "";
     if ($page) {
         $limit = " LIMIT {$n}, {$perpage}";
     }
     // this variables Omnigrid will send only if serverSort option is true
     $sorton = bRequest::getVar("sorton", false);
     $sortby = bRequest::getVar("sortby");
     //setting pagination query
     $where = "";
     if ($sorton) {
         $where = " ORDER BY {$sorton} {$sortby} ";
     }
     //set the query
     $query = "SELECT * FROM " . $this->_tbl . $where . $limit;
     //set and run the query
     $this->_db->setQuery($query);
     $this->_db->query();
     $results = $this->_db->loadAssocList();
     //set the query
     $query = "SELECT * FROM " . $this->_tbl;
     //set and run the query
     $this->_db->setQuery($query);
     $this->_db->query();
     $total = $this->_db->getNumRows();
     // return the json results
     $return = array("page" => $page, "total" => $total, "data" => $results);
     echo json_encode($return);
     return;
 }
コード例 #2
0
ファイル: omnitable.php プロジェクト: Jonathonbyrd/Member-Pro
 /**
  * stores the data
  * @return none
  */
 function saveCapabilities()
 {
     $table =& bTable::getInstance($this->table, 'Table');
     $table->load(bRequest::getVar('role'));
     $table->setCapabilities(bRequest::get('get'));
     print_r($table->getProperties());
     $table->store();
     echo 'Item Saved!';
 }
コード例 #3
0
 /**
  * Checks for a form token in the request
  *
  * Use in conjuction with JHTML::_( 'form.token' )
  *
  * @param	string	The request method in which to look for the token key
  * @return	boolean	True if found and valid, false otherwise
  */
 public static function checkToken($method = 'post')
 {
     $token = JUtility::getToken();
     if (!bRequest::getVar($token, '', $method, 'alnum')) {
         $session = JFactory::getSession();
         if ($session->isNew()) {
             //Redirect to login screen
             global $mainframe;
             $return = JRoute::_('index.php');
             $mainframe->redirect($return, JText::_('SESSION_EXPIRED'));
             $mainframe->close();
         } else {
             return false;
         }
     } else {
         return true;
     }
 }
コード例 #4
0
 /**
  * deletes the record
  * @return none
  */
 function delete()
 {
     $table =& bTable::getInstance($this->table, 'Table');
     //loop through the keys
     $keys = split(',', bRequest::getVar('keys'));
     foreach ($keys as $key => $id) {
         if ($id != '') {
             //$table->load( $id );
             $table->delete($id);
         }
     }
     echo 'Items Deleted.';
 }