<?php

/**
 * Class that operate on table 'otherrequest'. Database Mysql.
 *
 * @author: http://phpdao.com
 * @date: 2016-10-24 14:31
 */
class OtherrequestMySqlExtDAO extends OtherrequestMySqlDAO {

    public function getRequestsWithString($string, $seen, $deleted) {
        $sql = 'SELECT o.*   , b.branchName  as branchName , u.username  as userName
                        FROM otherrequest         o
                        join branch               b       on b.branchId = o.branchId
                        join user                 u       on u.userid   = o.userId
                        where       seen  in ( ' . $seen . ' )   ' . $string . '  
                        and   deleted = ' . $deleted . '
                        ';

        //print_r($sql . '<br/>');

        $sqlQuery = new SqlQuery($sql);
        return $this->getList($sqlQuery);
    }

    public function getRequestsWithStringEx($string, $seen, $deleted) {
        $sql = 'SELECT o.*   ,"كل الفروع"     as branchName , u.username  as userName
                        FROM otherrequest         o
                        join user                 u       on u.userid   = o.userId
                        where       seen  in ( ' . $seen . ' )   ' . $string . '
                        and   deleted = ' . $deleted . '
                        ';

        //print_r($sql . '<br/>');

        $sqlQuery = new SqlQuery($sql);
        return $this->getList($sqlQuery);
    }

    public function getRequestsWithStringCount($string, $seen, $deleted) {
        $sql = 'SELECT o.id  FROM otherrequest     o
                        where       seen  in ( ' . $seen . ' )   ' . $string . '
                        and   deleted = ' . $deleted . '
                        ';

        print_r($sql . '<br/>');

        $sqlQuery = new SqlQuery($sql);
        return $this->getList($sqlQuery);
    }

}

?>