Beispiel #1
0
/**
 * Seleciona as faculdades da universidade
 * @return array
 */
function getAllFaculdades()
{
    $queryFaculdade = "select * from faculdade";
    $resultFaculdade = queryMysqli($queryFaculdade, array());
    $resultsArray = $resultFaculdade->fetchAll(PDO::FETCH_ASSOC);
    return json_encode($resultsArray);
}
 /**
  * checks if a given user exists in the database
  *
  * @access public
  * @author firstname and lastname of author, <*****@*****.**>
  * @param  String username
  * @param  String token
  * @return Boolean
  */
 public static function existUser($username)
 {
     $query = 'select * from user where username=?';
     $result = queryMysqli($query, array($username));
     if ($result->rowCount() > 0) {
         return true;
     }
     return false;
 }
 /**
  * check if a token is valid for a given caretaker
  *
  * @author firstname and lastname of author, <*****@*****.**>
  * @param  String username
  * return boolean
  */
 public static function validateCaretaker($caretaker, $token)
 {
     $query = 'select * from caretaker where username=? and token=?';
     $result = queryMysqli($query, array($caretaker, $token));
     if ($result->rowCount() > 0) {
         return true;
     }
     return false;
 }
 public static function getPacientInfoObj($id)
 {
     $query = 'select * from pacient_info where id=?';
     $result = queryMysqli($query, array($id));
     $object = $result->fetchObject();
     return new WS2_PacientInfo($object->pacient, $object->activityName, $object->url, $object->typeWS, $object->method, $object->param);
 }
 /**
  * query an activity by username and name of the activity
  *
  * @access public
  * @author firstname and lastname of author, <*****@*****.**>
  * @param  String username
  * @param  String activityName
  * @return Array
  */
 public static function queryActivity($username, $activityName)
 {
     $query = "select *  from activity where username=? and name=?";
     $queryResult = array();
     $result = queryMysqli($query, array($username, $activityName));
     if ($result->rowCount() < 1) {
         return null;
     } else {
         for ($i = 0; $i < $result->rowCount(); $i++) {
             $object = $result->fetchObject();
             array_push($queryResult, $object->username . ' ' . $object->name . ' ' . $object->start . ' ' . $object->end . ' ');
         }
     }
     return $queryResult;
 }
 /**
  * check if a caretaker is authorized to access a pacient activity
  *
  * @author firstname and lastname of author, <*****@*****.**>
  * @param  String caretaker
  * @param  Integer pacientInfo
  * return String
  */
 public static function isCaretakerAuthorized($pacientInfo, $caretaker)
 {
     $query = 'select * from authorization where pacient_info=? and caretaker=?';
     $result = queryMysqli($query, array($pacientInfo, $caretaker));
     if ($result->rowCount() > 0) {
         return true;
     }
     return false;
 }