Esempio n. 1
0
 public static function loadById($id)
 {
     $mysql = CL_MySQL::getInstance();
     $mysql->select('user', '*', ['id' => $id]);
     $o = $mysql->fetchObject();
     if ($o === NULL) {
         return NULL;
     }
     return new UserModel($o);
 }
 function __construct()
 {
     parent::CL_Controller();
     $this->load->model('ModelModel');
     $this->load->model('ScenarioModel');
     $this->load->model('ContextModel');
     $this->load->model('QueryModel');
     $this->load->model('TempModel');
     $this->db = CL_MySQL::getInstance();
 }
 public static function loadByUser($userId)
 {
     $db = CL_MySQL::getInstance();
     $db->select('study', '*', ['study_to_user' => ['studyId' => 'id']], ['study_to_user.userId' => $userId]);
     //        echo $db->getQuery();
     //        exit();
     $studies = [];
     while ($o = $db->fetchObject()) {
         $studies[] = self::fromObject($o);
     }
     return $studies;
 }
Esempio n. 4
0
 function __construct()
 {
     parent::CL_Controller();
     $this->load->model('CaseModel');
     $this->load->model('ModelModel');
     $this->load->model('ScenarioModel');
     $this->load->model('QueryModel');
     $this->load->model('ContextModel');
     $this->db = CL_MySQL::getInstance();
     if (!$this->session->is_set('caseId')) {
         $this->location('/');
     }
 }
Esempio n. 5
0
 function log($url, $id)
 {
     $mysql = CL_MySQL::getInstance();
     $mysql->insert('blog', ['url' => $url, 'id' => $id]);
 }
Esempio n. 6
0
/**
 * Shortcut for instantiating mysql.
 * 
 * @return CL_MySQL
 */
function cl_mysql()
{
    return CL_MySQL::getInstance();
}
Esempio n. 7
0
 public static function remove($id, $caseId)
 {
     $db = CL_MySQL::getInstance();
     $db->query("DELETE FROM `temp` WHERE `id` = '{$id}' AND `caseId` = {$caseId}");
 }