Example #1
0
 public function pageList($p, $z)
 {
     $table = DbObject::_getTableSchema($this->class);
     $objects = DbObject::_find($this->class, $this->conditions, array('orderby' => $this->orderby . ', id'));
     $this->assign('table', $table);
     $this->assign('objects', $objects);
 }
Example #2
0
 public function pageData($p, $z)
 {
     header('Content-type: text/xml');
     $this->layout = 'plain';
     $entries = DbObject::_find('Entry');
     $this->assign('entries', $entries);
 }
Example #3
0
 public function getPermittedRequests()
 {
     if ($this->id == self::rootId) {
         $requests = DbObject::_find('Request', NULL, array('orderby' => 'id'));
     } else {
         $requests = $this->request;
     }
     return $requests;
 }
Example #4
0
 public function pageDestroy()
 {
     //	you shouldn't really do stuff like this in a page function
     $all = DbObject::_find('PersonStuff');
     foreach ($all as $thisObject) {
         $thisObject->destroy();
     }
     $all = DbObject::_find('GuidPerson');
     foreach ($all as $thisObject) {
         $thisObject->destroy();
     }
 }
Example #5
0
 function pageList($p, $z)
 {
     $people = DbObject::_find('Person');
     $this->assign('people', $people);
 }
Example #6
0
 public function pageDefault($p, $z)
 {
     $entries = DbObject::_find('Entry');
     $this->assign('entries', $entries);
     // echo_r($entries);
 }
Example #7
0
 public function postBoard()
 {
     $boards = DbObject::_find('Board', array('name' => 'default'));
     $board = $boards[1];
     $board->saveCells($_POST['cell']);
     Redirect(virtual_url);
 }
Example #8
0
 /**
  * Retrieve one object from the database and map it to an object.  Throws an error if more than one row is returned.
  *
  * @param string $className The name of the class corresponding to the table in the database
  * @param array $conditions Key value pair for the fields you want to look up
  * @return DbObject
  */
 public static function _findOne($className, $conditions = NULL, $params = null)
 {
     $a = DbObject::_find($className, $conditions, $params);
     if (!$a) {
         return false;
     }
     assert(is_array($a));
     if (count($a) < 1) {
         return false;
     }
     if (count($a) > 1) {
         trigger_error("one row was requested but " . count($a) . " were returned");
     }
     return current($a);
 }
Example #9
0
 /**
  * Retrieve one object from the database and map it to an object.  Throws an error if more than one row is returned.
  *
  * @param string $className The name of the class corresponding to the table in the database
  * @param array $conditions Key value pair for the fields you want to look up
  * @return DbObject
  */
 public static function _findOne($className, $conditions = NULL)
 {
     $a = DbObject::_find($className, $conditions);
     if (!$a) {
         return false;
     }
     assert(is_array($a));
     assert(count($a) == 1);
     return current($a);
 }