/**
  * Test loadObject method
  *
  * @return  void
  *
  * @since   11.1
  */
 public function testLoadObject()
 {
     $query = $this->object->getQuery(true);
     $query->select('*');
     $query->from('jos_dbtest');
     $query->where('description=' . $this->object->quote('three'));
     $this->object->setQuery($query);
     $result = $this->object->loadObject();
     $objCompare = new stdClass();
     $objCompare->id = 3;
     $objCompare->title = 'Testing3';
     $objCompare->start_date = '1980-04-18 00:00:00';
     $objCompare->description = 'three';
     $this->assertThat($result, $this->equalTo($objCompare), __LINE__);
 }
Esempio n. 2
0
 /**
  * This global function loads the first row of a query into an object
  *
  * If an object is passed to this function, the returned row is bound to the existing elements of <var>object</var>.
  * If <var>object</var> has a value of null, then all of the returned query fields returned in the object.
  *
  * @param object The address of variable
  */
 function loadObject(&$object)
 {
     if ($object != null) {
         if (!($cur = $this->query())) {
             return false;
         }
         if ($array = mysql_fetch_assoc($cur)) {
             mysql_free_result($cur);
             mosBindArrayToObject($array, $object, null, null, false);
             return true;
         } else {
             return false;
         }
     } else {
         $object = parent::loadObject();
         return $object;
     }
 }
Esempio n. 3
0
define('_JEXEC', 1);
define('JPATH_BASE', 1);
include_once "../../../../../../configuration.php";
include_once "../../../../../../libraries/joomla/base/object.php";
include_once "../../../../../../libraries/joomla/database/database.php";
include_once "../../../../../../libraries/joomla/database/database/mysql.php";
$config = new JConfig();
$options = array("host" => $config->host, "user" => $config->user, "password" => $config->password, "database" => $config->db, "prefix" => $config->dbprefix);
$database = new JDatabaseMySQL($options);
$sql = " SELECT id, days, tasks FROM #__guru_programstatus WHERE pid = 27 ";
$database->setQuery($sql);
if (!$database->query()) {
    echo $database->stderr();
    return;
}
$ids = $database->loadObject();
$the_old_day_order = $ids->days;
$the_old_day_order = explode(';', $the_old_day_order);
$the_old_task_order = $ids->tasks;
$the_old_task_order = explode(';', $the_old_task_order);
$new_daystatus_order = '';
$new_taskstatus_order = '';
foreach ($items as $one_item) {
    //one_item looks like this ->  6-0:false:202:
    $one_item_array = explode(':', $one_item);
    if ($one_item_array[1] == 'false') {
        // saving the new order
        $day_id = $one_item_array[2];
        $sql = " SELECT ordering FROM #__guru_days WHERE id = " . $day_id;
        $database->setQuery($sql);
        $database->query();