Ejemplo n.º 1
0
 public function readByPk($pk, $col = NULL)
 {
     if (!is_numeric($pk)) {
         // try to catch the situation when the $pk is null
         return FALSE;
     } else {
         return parent::readByPk($pk, $col);
     }
 }
Ejemplo n.º 2
0
 public function getPackageIdFromBlockID($block_id)
 {
     if ($block_id != NULL) {
         $block_info = parent::readByPk($block_id, ["pid"]);
         if ($block_info != NULL) {
             return $block_info["pid"];
         }
     }
     return FALSE;
 }
Ejemplo n.º 3
0
 public function addGidIntoExpr($expr_id, $gid = NULL)
 {
     if (!isset($gid) || !empty($gid) || parent::count(["gid" => $gid]) > 0) {
         $gid = $this->next_gid();
     }
     $data = parent::readByPk($expr_id, $this->fields);
     if ($data) {
         $data["gid"] = $gid;
         $data["is_forked"] = TRUE;
         // create
         return parent::create($data);
     } else {
         $this->err_msg = "Invalid Experiment ID";
         $this->err_code = 404;
         return FALSE;
     }
 }
Ejemplo n.º 4
0
 /**
  * Get user Information
  */
 public function getUserInfo($pid)
 {
     //check permission
     if ($this->is_login() === TRUE) {
         if ($this->pid == $pid || $this->pid == 0) {
             return parent::readByPk($pid);
         } else {
             return $this->set_err(400, "No permission: You can't see the information of another user");
         }
     } else {
         return $this->set_err(400, "No permission: haven't logged in yet~");
     }
 }