Ejemplo n.º 1
0
 /**
  * 
  * @param array $condition
  * @param array $filter
  * @return Dao_Md_User_Record_Email
  */
 public function getEmail(array $condition, $filter = null)
 {
     $table = 'md_email';
     $columns = 'org_id AS orgid, user_id AS userid, address, password, protocol, imap_host AS host, port, ' . 'is_ssl AS isssl, type, last_check_info AS lastcheckinfo, last_check_time AS lastchecktime, ' . 'order_num AS ordernum';
     $where = array();
     if (!empty($condition['orgid'])) {
         $where[] = 'org_id = ' . $this->_db->quote($condition['orgid']);
     }
     if (!empty($condition['userid'])) {
         $where[] = 'user_id = ' . $this->_db->quote($condition['userid']);
     }
     if (!empty($condition['address'])) {
         $where[] = 'address = ' . $this->_db->quote($condition['address']);
     }
     if (!$where) {
         return null;
     }
     $where = implode(' AND ', $where);
     $sql = "SELECT {$columns} FROM {$table} WHERE {$where} LIMIT 1";
     try {
         $record = $this->_db->fetchRow($sql);
         if (!$record) {
             return null;
         }
         return Oray_Dao::record('Dao_Md_User_Record_Email', $record);
     } catch (Zend_Db_Exception $e) {
         $this->_catchException($e, __METHOD__);
         return null;
     }
 }
Ejemplo n.º 2
0
 /**
  * SELECT
  * flow_id AS flowid, org_id AS orgid, board_id AS boardid, unique_id AS uniqueid, subject, description,
  * avaliable, is_valid AS isvalid, cc, elapsed_time AS elapsedtime, content, steps, create_time AS createtime
  * FROM td_flow
  * WHERE flow_id = :flowid AND unique_id = :uniqueid
  * LIMIT 0, 1
  *
  * @param array $condition
  * @param array $filter
  * @return boolean|NULL
  */
 public function getFlow(array $condition, $filter = null)
 {
     if (empty($condition['flowid'])) {
         return false;
     }
     $table = 'td_flow';
     $columns = 'flow_id AS flowid, org_id AS orgid, board_id AS boardid, unique_id AS uniqueid, subject, description, class_id as classid, ' . 'avaliable, is_valid AS isvalid, cc, elapsed_time AS elapsedtime, content, steps, create_time AS createtime';
     $where = array();
     $where[] = 'flow_id = ' . $this->_db->quote($condition['flowid']);
     if (isset($condition['uniqueid'])) {
         $where[] = 'unique_id = ' . $this->_db->quote($condition['uniqueid']);
     }
     if (!empty($filter) && array_key_exists('isvalid', $filter)) {
         if (null !== $filter['isvalid']) {
             $where[] = 'is_valid = ' . (int) $filter['isvalid'];
         }
     }
     $where = implode(' AND ', $where);
     if ($where) {
         $where = 'WHERE ' . $where;
     }
     $sql = "SELECT {$columns} FROM {$table} {$where} LIMIT 0, 1";
     $record = $this->_db->fetchRow($sql);
     if (!$record) {
         return null;
     }
     return Oray_Dao::record('Dao_Td_Flow_Record_Flow', $record);
 }
Ejemplo n.º 3
0
 /**
  * 获取签到日期的签到统计记录
  *
  * @param array $condition
  * @param array $filter
  * @return boolean|NULL|Dao_App_Attend_Record_Date
  */
 public function getAttendDate(array $condition, $filter = null)
 {
     if (empty($condition['uniqueid']) || empty($condition['date'])) {
         return false;
     }
     $table = 'attend_date d ' . 'LEFT JOIN attend_date_apply ad ON ad.org_id = d.org_id AND d.unique_id = ad.unique_id AND d.date = ad.date';
     $columns = 'd.org_id AS orgid, d.unique_id AS uniqueid, d.date, d.is_late AS islate, d.is_leave AS isleave, ' . 'd.is_work AS iswork, d.checkin_status AS checkinstatus, d.work_time AS worktime, d.update_time AS updatetime, ' . 'GROUP_CONCAT(DISTINCT(ad.memo)) AS memo, GROUP_CONCAT(DISTINCT(ad.category_id)) AS categories';
     $recordClass = 'Dao_App_Attend_Record_Date';
     $where = array();
     $bind = array('uniqueid' => $condition['uniqueid'], 'date' => $condition['date']);
     $where[] = 'd.unique_id = :uniqueid AND d.date = :date';
     if (isset($condition['orgid'])) {
         $where[] = 'd.org_id = :orgid';
         $bind['orgid'] = $condition['orgid'];
     }
     $where = 'WHERE ' . implode(' AND ', $where);
     $sql = "SELECT {$columns} FROM {$table} {$where} GROUP BY d.unique_id, d.date LIMIT 0, 1";
     try {
         $record = $this->_db->fetchRow($sql, $bind);
         if (!$record) {
             return null;
         }
         return Oray_Dao::record($recordClass, $record);
     } catch (Zend_Db_Exception $e) {
         $this->_catchException($e, __METHOD__);
         return null;
     }
 }
Ejemplo n.º 4
0
 /**
  *
  * @param array $condition
  * @param array $filter
  * @return Oray_Dao_Recordset
  */
 public function getFolder(array $condition, $filter = null)
 {
     $table = 'nd_folder';
     $columns = 'org_id AS orgid, unique_id AS uniqueid, folder_id AS folderid, parent_folder_id AS parentfolderid, ' . 'folder_name AS foldername, max_quota AS maxquota, folder_size AS foldersize, create_time AS createtime, ' . 'is_system AS issystem, is_share AS isshare';
     $where = array();
     $order = array();
     $limit = '';
     if (!empty($condition['uniqueid'])) {
         $where[] = 'unique_id = ' . $this->_db->quote($condition['uniqueid']);
     }
     if (!empty($condition['orgid'])) {
         $where[] = 'org_id = ' . $this->_db->quote($condition['orgid']);
     }
     if (!empty($condition['folderid'])) {
         $where[] = 'folder_id = ' . $this->_db->quote($condition['folderid']);
     }
     if (!$where) {
         return null;
     }
     $where = implode(' AND ', $where);
     $sql = "SELECT {$columns} FROM {$table} WHERE {$where}";
     try {
         $record = $this->_db->fetchRow($sql);
         if (!$record) {
             return null;
         }
         return Oray_Dao::record('Dao_Td_Netdisk_Record_Folder', $record);
     } catch (Zend_Db_Exception $e) {
         $this->_catchException($e, __METHOD__);
         return fasle;
     }
 }
Ejemplo n.º 5
0
 /**
  * 获取应用
  *
  * @param array $condition
  * @param unknown_type $filter
  */
 public function getAppUser(array $condition, $filter = null)
 {
     $table = 'app_user';
     $columns = 'org_id AS orgid, app_id AS appid, item_id AS itemid, role';
     $where = array();
     $bind = array();
     if (!empty($condition['orgid'])) {
         $where[] = 'org_id = :orgid';
         $bind['orgid'] = $condition['orgid'];
     }
     if (!empty($condition['appid'])) {
         $where[] = 'app_id = :appid';
         $bind['appid'] = $condition['appid'];
     }
     if (!empty($condition['itemid'])) {
         $where[] = 'item_id = :itemid';
         $bind['itemid'] = $condition['itemid'];
     }
     if (empty($where)) {
         return null;
     }
     $where = implode(' AND ', $where);
     $sql = "SELECT {$columns} FROM {$table} WHERE {$where} LIMIT 1";
     try {
         $record = $this->_db->fetchRow($sql);
         if (!$record) {
             return null;
         }
         return Oray_Dao::record($record, 'Dao_App_App_User');
     } catch (Zend_Db_Exception $e) {
         $this->_catchException($e, __METHOD__);
         return null;
     }
 }
Ejemplo n.º 6
0
 /**
  * Get record
  *
  * SELECT org_id AS orgid, board_id AS boardid, unique_id AS uniqueid, tudu_id AS tuduid, post_id AS postid,
  * is_first AS isfirst, is_log AS islog, is_send AS issend, content, percnet, last_modify AS lastmodify,
  * poster, poster_info AS post_info, attach_num AS attachnum, elapsed_time AS elapsedtime, create_time AS createtime
  * WHERE tudu_id = ? AND post_id = ?
  *
  * @param array $condition
  * @param array $filter
  * @return Dao_Td_Tudu_Record_Post
  */
 public function getPost(array $condition, $filter = null)
 {
     $table = "td_post";
     $columns = "org_id AS orgid, board_id AS boardid, unique_id AS uniqueid, email, tudu_id AS tuduid, post_id AS postid, header, " . "is_first AS isfirst, is_log AS islog, is_send AS issend, content, percent, last_modify AS lastmodify, " . "poster, poster_info AS posterinfo, attach_num AS attachnum, elapsed_time AS elapsedtime, create_time AS createtime, " . "is_foreign AS isforeign";
     $where = array();
     if (isset($condition['tuduid'])) {
         $where[] = 'tudu_id = ' . $this->_db->quote($condition['tuduid']);
     }
     if (isset($condition['postid'])) {
         $where[] = 'post_id = ' . $this->_db->quote($condition['postid']);
     }
     if (isset($condition['uniqueid'])) {
         $where[] = 'unique_id = ' . $this->_db->quote($condition['uniqueid']);
     }
     if (isset($condition['issend'])) {
         $where[] = 'is_send = ' . $this->_db->quote($condition['issend']);
     }
     if (empty($where)) {
         return null;
     }
     // WHERE
     $where = implode(' AND ', $where);
     $sql = "SELECT {$columns} FROM {$table} WHERE {$where} LIMIT 0, 1";
     $record = $this->_db->fetchRow($sql);
     if (!$record) {
         return null;
     }
     return Oray_Dao::record('Dao_Td_Tudu_Record_Post', $record);
 }
Ejemplo n.º 7
0
 /**
  * 获取单个考勤分类的统计结果
  *
  * SELECT at.category_id AS categoryid, at.category_name AS categoryname, at.org_id AS orgid, 
  * at.unique_id AS uniqueid, at.date, at.total, at.update_time AS updatetime
  * FROM attend_total
  * WHERE category_id = :categoryid AND unique_id = uniqueid AND date = :date
  * LIMIT 0, 1
  *
  * @param array $condition
  * @return Dao_App_Attend_Record_Total|NULL|boolean
  */
 public function getAttendTotal(array $condition)
 {
     if (empty($condition['categoryid']) || empty($condition['uniqueid']) || empty($condition['date'])) {
         return false;
     }
     $table = 'attend_total at ' . 'LEFT JOIN attend_category ac ON at.org_id = ac.org_id AND at.category_id = ac.category_id';
     $columns = 'at.category_id AS categoryid, ac.category_name AS categoryname, at.org_id AS orgid, at.unique_id AS uniqueid, ' . 'at.date, at.total, at.update_time AS updatetime';
     $where = array();
     $recordClass = 'Dao_App_Attend_Record_Total';
     $bind = array('categoryid' => $condition['categoryid'], 'uniqueid' => $condition['uniqueid'], 'date' => $condition['date']);
     $where[] = 'at.category_id = :categoryid';
     $where[] = 'at.unique_id = :uniqueid';
     $where[] = 'at.date = :date';
     $where = 'WHERE ' . implode(' AND ', $where);
     $sql = "SELECT {$columns} FROM {$table} {$where} LIMIT 0, 1";
     try {
         $record = $this->_db->fetchRow($sql, $bind);
         if (!$record) {
             return null;
         }
         return Oray_Dao::record($recordClass, $record);
     } catch (Zend_Db_Exception $e) {
         $this->_catchException($e, __METHOD__);
         return null;
     }
 }
Ejemplo n.º 8
0
 /**
  * 读取图度规则
  *
  * @param $condition
  * @param $filter
  */
 public function getRule(array $condition, $filter = null)
 {
     $table = 'td_rule';
     $columns = 'rule_id AS ruleid, unique_id AS uniqueid, description, operation, mail_remind AS mailremind, value, is_valid AS isvalid';
     $where = array();
     if (!empty($condition['ruleid'])) {
         $where[] = 'rule_id = ' . $this->_db->quote($condition['ruleid']);
     }
     if (!empty($condition['uniqueid'])) {
         $where[] = 'unique_id = ' . $this->_db->quote($condition['uniqueid']);
     }
     if (empty($where)) {
         return null;
     }
     if (isset($filter['isvalid'])) {
         $where[] = 'is_valid = ' . ($filter['isvalid'] ? 1 : 0);
     }
     $where = implode(' AND ', $where);
     $sql = "SELECT {$columns} FROM {$table} WHERE {$where} LIMIT 1";
     try {
         $record = $this->_db->fetchRow($sql);
         if (!$record) {
             return null;
         }
         return Oray_Dao::record('Dao_Td_Rule_Record_Rule', $record);
     } catch (Zend_Db_Exception $e) {
         $this->_catchException($e, __METHOD__);
         return null;
     }
 }
Ejemplo n.º 9
0
 /**
  *
  * @param array $condition
  * @param array $filter
  * @return Dao_Td_Record_Flow
  */
 public function getFlow(array $condition, $filter = null)
 {
     $table = 'td_tudu_flow';
     $columns = 'org_id as orgid, tudu_id as tuduid, flow_id as flowid, current_step_id as currentstepid, steps';
     $where = array();
     $bind = array();
     if (isset($condition['tuduid'])) {
         $where[] = 'tudu_id = :tuduid';
         $bind['tuduid'] = $condition['tuduid'];
     }
     if (empty($where)) {
         return null;
     }
     $where = implode(' AND ', $where);
     $sql = "SELECT {$columns} FROM {$table} WHERE {$where} LIMIT 1";
     try {
         $record = $this->_db->fetchRow($sql, $bind);
         if (!$record) {
             return null;
         }
         return Oray_Dao::record('Dao_Td_Tudu_Record_Flow', $record);
     } catch (Zend_Db_Exception $e) {
         $this->_catchException($e, __METHOD__);
         return null;
     }
 }
Ejemplo n.º 10
0
 /**
  * SELECT realname_id AS realnameid, org_id AS orgid, file_url AS fileurl, status, create_time AS createtime
  * FROM md_org_realname
  * WHERE realname_id = :realnameid
  * [AND org_id = :orgid]
  * LIMIT 0, 1
  *
  * @param array $condition
  * @param array $filter
  * @return Dao_Md_Org_Record_Real
  */
 public function getRealName(array $condition, $filter = null)
 {
     $table = 'md_org_realname';
     $columns = 'realname_id AS realnameid, org_id AS orgid, file_url AS fileurl, status, memo, create_time AS createtime, update_time AS updatetime';
     $recordClass = 'Dao_Md_Org_Record_Real';
     $where = array();
     if (!empty($condition['realnameid'])) {
         $where[] = 'realname_id = ' . $this->_db->quote($condition['realnameid']);
     }
     if (!empty($condition['orgid'])) {
         $where[] = 'org_id = ' . $this->_db->quote($condition['orgid']);
     }
     if (!$where) {
         return null;
     }
     if ($filter && !empty($filter['status'])) {
         $where[] = 'status = ' . (int) $filter['status'];
     }
     $where = implode(' AND ', $where);
     $sql = "SELECT {$columns} FROM {$table} WHERE {$where} ORDER BY create_time DESC LIMIT 1";
     $record = $this->_db->fetchRow($sql);
     if (!$record) {
         return null;
     }
     return Oray_Dao::record($recordClass, $record);
 }
Ejemplo n.º 11
0
 /**
  * 获取文件记录
  *
  * @param $condition
  * @param $filter
  */
 public function getFile(array $condition, $filter = null)
 {
     $table = 'nd_file';
     $columns = 'org_id AS orgid, unique_id AS uniqueid, folder_id AS folderid, file_id AS fileid, is_from_attach as isfromattach, ' . 'attach_file_id AS attachfileid, file_name AS filename, size, path, type, is_share AS isshare, create_time AS createtime, ' . 'from_unique_id AS fromuniqueid, from_file_id AS fromfileid';
     $where = array();
     if (!empty($condition['uniqueid'])) {
         $where[] = 'unique_id = ' . $this->_db->quote($condition['uniqueid']);
     }
     if (!empty($condition['fileid'])) {
         $where[] = 'file_id = ' . $this->_db->quote($condition['fileid']);
     }
     if (empty($where)) {
         return null;
     }
     $where = implode(' AND ', $where);
     $sql = "SELECT {$columns} FROM {$table} WHERE {$where}";
     try {
         $record = $this->_db->fetchRow($sql);
         if (!$record) {
             return null;
         }
         return Oray_Dao::record('Dao_Td_Netdisk_Record_File', $record);
     } catch (Zend_Db_Exception $e) {
         $this->_catchException($e, __METHOD__);
         return null;
     }
 }
Ejemplo n.º 12
0
 /**
  * 获取组织信息
  *
  * @param array $condition
  * @param array $filter
  * @return Dao_Md_Org_Record_Org
  */
 public function getOrg(array $condition, $filter = null)
 {
     $table = 'md_organization o ' . 'LEFT JOIN md_org_info oi ON o.org_id = oi.org_id ';
     $columns = 'o.org_id AS orgid, org_name AS orgname, oi.entire_name AS entirename, ts_id AS tsid, status, ' . 'create_time AS createtime, expire_date AS expiredate, ' . 'intro, skin, login_skin AS loginskin, is_active as isactive, ' . 'password_level AS passwordlevel, lock_time AS locktime, timezone, date_format AS dateformat, ' . 'is_ip_rule AS isiprule, o.default_password AS defaultpassword, o.is_https AS ishttps, o.time_limit AS timelimit';
     $where = array();
     $bind = array();
     if (!empty($condition['orgid'])) {
         $where[] = 'o.org_id = :orgid';
         $bind['orgid'] = $condition['orgid'];
     }
     if (!empty($condition['host'])) {
         $where[] = 'o.org_id = (SELECT org_id FROM md_org_host WHERE host = :host)';
         $bind['host'] = $condition['host'];
     }
     if (!$where) {
         return null;
     }
     $where = implode(' AND ', $where);
     $sql = "SELECT {$columns} FROM {$table} WHERE {$where} LIMIT 0, 1";
     try {
         $record = $this->_db->fetchRow($sql, $bind);
         if (!$record) {
             return null;
         }
         return Oray_Dao::record('Dao_Md_Org_Record_Org', $record);
     } catch (Zend_Db_Exception $e) {
         $this->_catchException($e, __METHOD__);
         return null;
     }
 }
Ejemplo n.º 13
0
 /**
  * 获取考勤申请详细信息
  *
  * @param array $conditions
  * @param mixed $filter
  * @return Dao_Attend_Record_Apply
  */
 public function getApply(array $condition, $filter = null)
 {
     $table = 'attend_apply AS a LEFT JOIN attend_category AS c ON a.category_id = c.category_id';
     $columns = 'a.apply_id AS applyid, a.org_id AS orgid, a.tudu_id AS tuduid, a.category_id AS categoryid, a.unique_id AS uniqueid, a.period, ' . 'a.sender_id AS senderid, a.user_info AS userinfo, a.is_allday AS isallday, a.checkin_type AS checkintype, a.status, ' . 'a.start_time AS starttime, a.end_time AS endtime, a.create_time AS createtime, c.category_name as categoryname';
     $where = array();
     $bind = array();
     if (!empty($condition['applyid'])) {
         $where[] = 'a.apply_id = :applyid';
         $bind['applyid'] = $condition['applyid'];
     }
     if (!empty($condition['tuduid'])) {
         $where[] = 'a.tudu_id = :tuduid';
         $bind['tuduid'] = $condition['tuduid'];
     }
     if (empty($where)) {
         return null;
     }
     $where = implode(' AND ', $where);
     $sql = "SELECT {$columns} FROM {$table} WHERE {$where} LIMIT 1";
     try {
         $record = $this->_db->fetchRow($sql, $bind);
         if (!$record) {
             return null;
         }
         return Oray_Dao::record('Dao_App_Attend_Record_Apply', $record);
     } catch (Zend_Db_Exception $e) {
         $this->_catchException($e, __METHOD__);
         return null;
     }
 }
Ejemplo n.º 14
0
 /**
  * 获取一条模板记录
  * 
  * @param $condition
  * @param $filter
  * @return Dao_Td_Tudu_Template
  */
 public function getTemplate(array $condition, $filter = null)
 {
     $table = 'td_template';
     $columns = 'org_id AS orgid, board_id AS boardid, template_id AS templateid, creator, name, content, order_num AS ordernum';
     $where = array();
     if (isset($condition['orgid'])) {
         $where[] = 'org_id = ' . $this->_db->quote($condition['orgid']);
     }
     if (isset($condition['boardid'])) {
         $where[] = 'board_id = ' . $this->_db->quote($condition['boardid']);
     }
     if (isset($condition['templateid'])) {
         $where[] = 'template_id = ' . $this->_db->quote($condition['templateid']);
     }
     if (!$where) {
         return null;
     }
     // WHERE
     $where = implode(' AND ', $where);
     $sql = "SELECT {$columns} FROM {$table} WHERE {$where} LIMIT 1";
     try {
         $record = $this->_db->fetchRow($sql);
         if (!$record) {
             return null;
         }
         return Oray_Dao::record('Dao_Td_Tudu_Record_Template', $record);
     } catch (Zend_Db_Exception $e) {
         $this->_catchExecption($e, __METHOD__);
         return null;
     }
 }
Ejemplo n.º 15
0
 /**
  * 获取多条签到记录
  *
  * @param array $condition
  * @param array filter
  * @return Dao_App_Attend_Record_Checkin
  */
 public function getCheckin(array $condition, $filter = null)
 {
     $table = 'attend_checkin';
     $columns = 'checkin_id AS checkinid, org_id AS orgid, unique_id AS uniqueid, date, type, status, ip, ' . 'address, create_time AS createtime';
     $recordClass = 'Dao_App_Attend_Record_Checkin';
     $where = array();
     $bind = array();
     $where[] = 'org_id = :orgid';
     $bind['orgid'] = $condition['orgid'];
     $where[] = 'unique_id = :uniqueid';
     $bind['uniqueid'] = $condition['uniqueid'];
     $where[] = 'date = :date';
     $bind['date'] = $condition['date'];
     $where[] = 'type = :type';
     $bind['type'] = $condition['type'];
     $where = implode(' AND ', $where);
     if ($where) {
         $where = 'WHERE ' . $where;
     }
     $sql = "SELECT {$columns} FROM {$table} {$where} LIMIT 1";
     try {
         $record = $this->_db->fetchRow($sql, $bind);
         if (!$record) {
             return null;
         }
         return Oray_Dao::record($recordClass, $record);
     } catch (Zend_Db_Exception $e) {
         $this->_catchException($e, __METHOD__);
         return new Oray_Dao_Recordset();
     }
 }
Ejemplo n.º 16
0
 /**
  * 
  * @param array $condition
  * @param array $filter
  * @param mixed $sort
  * @param int   $maxCount
  * @return Oray_Dao_Recordset
  */
 public function getMeeting(array $condition, $filter = null, $sort = null, $maxCount = null)
 {
     $table = 'td_tudu_meeting';
     $columns = 'org_id AS orgid, tudu_id AS tuduid, notify_time AS notifytime, notify_type AS notifytype, location, ' . 'is_allday AS isallday';
     $where = array();
     $order = array();
     $limit = '';
     if (!empty($condition['tuduid'])) {
         $where[] = 'tudu_id = ' . $this->_db->quote($condition['tuduid']);
     }
     if (!$where) {
         return null;
     }
     // WHERE
     $where = implode(' AND ', $where);
     $sql = "SELECT {$columns} FROM {$table} WHERE {$where}";
     try {
         $record = $this->_db->fetchRow($sql);
         if (!$record) {
             return null;
         }
         return Oray_Dao::record('Dao_Td_Tudu_Record_Meeting', $record);
     } catch (Zend_Db_Exception $e) {
         $this->_catchException($e, __METHOD__);
         return null;
     }
 }
Ejemplo n.º 17
0
 /**
  * 获取IP地址信息
  *
  * @param array $condition
  */
 public function getInfo(array $condition, $filter = null)
 {
     $table = 'md_ip_data';
     $columns = 'start_ip AS startip, end_ip AS endip, province, city';
     $where = array();
     if (isset($condition['ip'])) {
         if (!is_int($condition['ip'])) {
             $condition['ip'] = sprintf('%u', ip2long($condition['ip']));
         }
         $where[] = "end_ip >= {$condition['ip']} AND start_ip <= {$condition['ip']}";
     }
     if (empty($where)) {
         return null;
     }
     $where = implode(' AND ', $where);
     $sql = "SELECT {$columns} FROM {$table} WHERE {$where} LIMIT 1";
     try {
         $record = $this->_db->fetchRow($sql);
         if (!$record) {
             return null;
         }
         return Oray_Dao::record('Dao_Md_Ip_Record_Info', $record);
     } catch (Zend_Db_Exception $e) {
         $this->_catchException($e, __METHOD__);
         return null;
     }
 }
Ejemplo n.º 18
0
 /**
  * 获取指定单个联系人群组数据,返回联系人群组记录对象,若群组不存在则返回null
  * 
  * SELECT group_id AS groupid, unique_id AS uniqueid, is_system AS issystem, name, bgcolor
  * FROM td_contact_group WHERE group_id = ? AND unique_id = ?
  * 
  * @param array $condition
  * @param array $filter
  * @return Dao_Td_Contact_Group
  */
 public function getGroup(array $condition, $filter = null)
 {
     $table = 'td_contact_group';
     $columns = 'group_id AS groupid, unique_id AS uniqueid, is_system AS issystem, name AS groupname, bgcolor, order_num AS ordernum ';
     $where = array();
     if (!empty($condition['groupid'])) {
         $where[] = 'group_id = ' . $this->_db->quote($condition['groupid']);
     }
     if (!empty($condition['uniqueid'])) {
         $where[] = 'unique_id = ' . $this->_db->quote($condition['uniqueid']);
     }
     if (!$where) {
         return null;
     }
     if (isset($filter['issystem'])) {
         $where[] = 'is_system = ' . ($filter['issystem'] ? 1 : 0);
     }
     $where = implode(' AND ', $where);
     $sql = "SELECT {$columns} FROM {$table} WHERE {$where} LIMIT 1";
     try {
         $record = $this->_db->fetchRow($sql);
         if (!$record) {
             return null;
         }
         return Oray_Dao::record('Dao_Td_Contact_Record_Group', $record);
     } catch (Zend_Db_Exception $e) {
         $this->_catchException($e);
         return null;
     }
 }
Ejemplo n.º 19
0
 /**
  * 获取群组数据
  *
  * @param array $condition
  * @param array $filter
  * @return Dao_Tudu_User_Record_Group
  */
 public function getRole(array $condition, $filter = null)
 {
     if (empty($condition['orgid']) || empty($condition['roleid'])) {
         return null;
     }
     $table = 'md_role';
     $columns = 'org_id AS orgid, role_id AS roleid, role_name AS rolename, is_system AS issystem, is_locked AS islocked, admin_level AS adminlevel';
     $where = array();
     $where[] = 'org_id = ' . $this->_db->quote($condition['orgid']);
     $where[] = 'role_id = ' . $this->_db->quote($condition['roleid']);
     $where = implode(' AND ', $where);
     $sql = "SELECT {$columns} FROM {$table} WHERE {$where} LIMIT 1";
     $record = $this->_db->fetchRow($sql);
     return Oray_Dao::record('Dao_Md_User_Record_Role', $record);
 }
Ejemplo n.º 20
0
 /**
  * 获取指定排班方案数据
  *
  * @param array $condition
  * @param mixed $filter
  * @return Dao_App_Attend_Record_Schedule
  */
 public function getSchedule(array $condition, $filter = null)
 {
     $table = 'attend_schedule s ' . 'LEFT JOIN attend_schedule_rule r ON s.schedule_id = r.schedule_id AND s.org_id = r.org_id';
     $columns = 's.org_id AS orgid, s.unique_id AS uniqueid, s.schedule_id AS scheduleid, s.name, s.is_system AS issystem, r.rule_id AS ruleid, r.week, ' . 's.bgcolor, r.checkin_time AS checkintime, r.checkout_time AS checkouttime, ' . 'r.late_standard AS latestandard, r.late_checkin AS latecheckin, ' . 'r.leave_checkout AS leavecheckout, r.status, s.create_time AS createtime';
     $where = array();
     $bind = array();
     $recordClass = 'Dao_App_Attend_Record_Schedule';
     if (!empty($condition['orgid'])) {
         $where[] = 's.org_id = :orgid';
         $bind['orgid'] = $condition['orgid'];
     }
     if (!empty($condition['scheduleid'])) {
         $where[] = 's.schedule_id = :scheduleid';
         $bind['scheduleid'] = $condition['scheduleid'];
     }
     if (isset($condition['week'])) {
         $where[] = 'r.week = :week';
         $bind['week'] = $condition['week'];
     }
     if (isset($condition['status'])) {
         $where[] = 'r.status = :status';
         $bind['status'] = $condition['status'];
     }
     if (!empty($filter) && array_key_exists('isvalid', $filter)) {
         if (null !== $filter['isvalid']) {
             $where[] = 's.is_valid = ' . (int) $filter['isvalid'];
         }
     }
     if (empty($where)) {
         return null;
     }
     $where = implode(' AND ', $where);
     if ($where) {
         $where = 'WHERE ' . $where;
     }
     $sql = "SELECT {$columns} FROM {$table} {$where}";
     try {
         $record = $this->_db->fetchRow($sql, $bind);
         if (!$record) {
             return null;
         }
         return Oray_Dao::record($recordClass, $record);
     } catch (Zend_Db_Exception $e) {
         $this->_catchException($e, __METHOD__);
         return null;
     }
 }
Ejemplo n.º 21
0
 /**
  *
  * @param array $condition
  * @param array $filter
  * @return Dao_Md_App_Record_App
  */
 public function getApp(array $condition, $filter = null)
 {
     if (empty($condition['orgid']) || empty($condition['appid'])) {
         return null;
     }
     $table = 'app_app a ' . 'LEFT JOIN app_info ai ON a.app_id = ai.app_id ' . 'LEFT JOIN app_user oa ON a.app_id = oa.app_id AND oa.org_id = ' . $this->_db->quote($condition['orgid']) . ' ';
     $columns = 'a.app_id AS appid, a.app_name AS appname, a.type, a.version, a.url, ai.author, ai.description, ai.logo, ai.languages, ' . 'ai.content, ai.score, ai.comment_num AS commentnum, ai.create_time AS createtime, ai.last_update_time AS lastupdatetime, ' . 'oa.status, oa.org_id AS orgid, oa.users, oa.expire_date AS expiredate';
     $where = array();
     $recordClass = 'Dao_Md_App_Record_App';
     $where[] = 'a.app_id = ' . $this->_db->quote($condition['appid']);
     $where = implode(' AND ', $where);
     $sql = "SELECT {$columns} FROM {$table} WHERE {$where}  LIMIT 0, 1";
     $record = $this->_db->fetchRow($sql);
     if (!$record) {
         return null;
     }
     return Oray_Dao::record($recordClass, $record);
 }
Ejemplo n.º 22
0
 /**
  * SELECT org_id AS orgid, industry, contact, tel, address, postcode, description
  * FROM md_org_info
  * WHERE org_id = :orgid
  *
  * @param array $condition
  * @param array $filter
  * @return Dao_Md_Org_Record_Info
  */
 public function getOrgInfo(array $condition, $filter = null)
 {
     $table = 'md_org_info';
     $columns = 'org_id AS orgid, entire_name AS entirename, industry, contact, tel, fax, province, city, address, postcode, description, realname_status AS realnamestatus ';
     $where = array();
     if (!empty($condition['orgid'])) {
         $where[] = 'org_id = ' . $this->_db->quote($condition['orgid']);
     }
     if (!$where) {
         return null;
     }
     $where = implode(' AND ', $where);
     $sql = "SELECT {$columns} FROM {$table} WHERE {$where} LIMIT 0, 1";
     $record = $this->_db->fetchRow($sql);
     if (!$record) {
         return null;
     }
     return Oray_Dao::record('Dao_Md_Org_Record_Info', $record);
 }
Ejemplo n.º 23
0
 /**
  *
  *
  * @param $condition
  * @param $filter
  * @return Dao_Td_Attachment_Record_File
  */
 public function getFile(array $condition, $filter = null)
 {
     $table = "td_attachment a " . "LEFT JOIN td_attach_post ap ON a.file_id = ap.file_id";
     $columns = "a.file_id AS fileid, a.file_name AS filename, a.size, a.type, a.path, " . "ap.tudu_id AS tuduid, ap.post_id AS postid, a.unique_id as uniqueid, " . "a.create_time AS createtime";
     $where = array();
     if (isset($condition['fileid'])) {
         $where[] = 'a.file_id = ' . $this->_db->quote($condition['fileid']);
     }
     if (!$where) {
         return null;
     }
     $where = implode(' AND ', $where);
     $sql = "SELECT {$columns} FROM {$table} WHERE {$where} LIMIT 1";
     $record = $this->_db->fetchRow($sql);
     if (!$record) {
         return null;
     }
     return Oray_Dao::record('Dao_Td_Attachment_Record_File', $record);
 }
Ejemplo n.º 24
0
 /**
  * 获取周期
  *
  * SELECT
  * cycle_id AS cycleid, mode, type, day, week, month, weeks,
  * at, what, period, count,
  * end_type AS endtype, end_count AS endcount, end_date AS enddate
  * FROM td_tudu_cycle
  * WHERE cycle_id = ?
  *
  * @param array $condition
  * @param array $filter
  * @return Dao_Td_Tudu_Record_Cycle
  */
 public function getCycle(array $condition, $filter = null)
 {
     $table = 'td_tudu_cycle';
     $columns = 'cycle_id AS cycleid, mode, type, day, week, month, weeks, ' . 'at, what, period, count, display_date AS displaydate, is_valid AS isvalid, is_keep_attach as iskeepattach, ' . 'end_type AS endtype, end_count AS endcount, end_date AS enddate';
     $where = array();
     if (!empty($condition['cycleid'])) {
         $where[] = 'cycle_id = ' . $this->_db->quote($condition['cycleid']);
     }
     if (!$where) {
         return null;
     }
     $where = implode(' AND ', $where);
     $sql = "SELECT {$columns} FROM {$table} WHERE {$where} LIMIT 1";
     $record = $this->_db->fetchRow($sql);
     if (!$record) {
         return null;
     }
     return Oray_Dao::record('Dao_Td_Tudu_Record_Cycle', $record);
 }
Ejemplo n.º 25
0
 /**
  * Get record
  * 
  * SELECT product_id AS productid, product_name AS productname FROM md_product WHERE product_id = ?
  * 
  * @param array $condition
  * @param array $filter
  * @return Dao_Md_Product_Record_Product
  */
 public function getProduct(array $condition, $filter = null)
 {
     $table = 'md_product';
     $columns = 'product_id AS productid, product_name AS productname';
     $where = array();
     if (!empty($condition['productid'])) {
         $where[] = 'product_id = ' . $this->_db->quote($condition['productid']);
     }
     if (empty($where)) {
         return null;
     }
     // WHERE
     $where = implode(' AND ', $where);
     $sql = "SELECT {$columns} FROM {$table} WHERE {$where} LIMIT 1";
     $record = $this->_db->fetchRow($sql);
     if (!$record) {
         return null;
     }
     return Oray_Dao::record('Dao_Md_Product_Record_Product', $record);
 }
Ejemplo n.º 26
0
 /**
  * Get record
  *
  * SQL here..
  *
  * @param array $condition
  * @param array $filter
  * @return Oray_Dao_Record
  */
 public function getAdminLog(array $condition, $filter = null)
 {
     $table = 'md_op_log';
     $columns = 'org_id AS orgid, user_id AS userid, module, action, sub_action AS subaction, ' . 'description, ip, local, create_time AS createtime';
     $where = array();
     if (empty($where)) {
         return null;
     }
     if (!empty($filter['orgid'])) {
         $where[] = 'org_id = ' . $this->_db->quote($filter['orgid']);
     }
     // WHERE
     $where = implode(' AND ', $where);
     $sql = "SELECT {$columns} FROM {$table} WHERE {$where} LIMIT 1";
     $record = $this->_db->fetchRow($sql);
     if (!$record) {
         return null;
     }
     return Oray_Dao::record('Dao_Md_Log_Record_Oplog', $record);
 }
Ejemplo n.º 27
0
 /**
  * Get record
  * 
  * SQL here..
  * 
  * @param array $condition
  * @param array $filter
  * @return Oray_Dao_Record
  */
 public function getRecord(array $condition, $filter = null)
 {
     $table = "";
     $columns = "";
     $where = array();
     // $condition ...
     if (empty($where)) {
         return null;
     }
     // $filter ...
     // WHERE
     $where = implode(' AND ', $where);
     $sql = "SELECT TOP 1 {$columns} FROM {$table} WHERE {$where}";
     //$sql = "SELECT {$columns} FROM {$table} WHERE {$where} LIMIT 1";
     $record = $this->_db->fetchRow($sql);
     if (!$record) {
         return null;
     }
     return Oray_Dao::record('Oray_Dao_Record', $record);
 }
Ejemplo n.º 28
0
 /**
  * 获取用户配置信息
  *
  *
  * @param array $condition
  * @param array $filter
  * @return Dao_Md_User_Record_Option
  */
 public function getOption(array $condition, $filter = null)
 {
     $table = 'md_user_data';
     $columns = 'org_id AS orgid, user_id AS userid, skin, timezone, language, pagesize, settings, ' . 'date_format AS dateformat, profile_mode AS profilemode, expired_filter AS expiredfilter, ' . 'post_sort AS postsort, usual_local AS usuallocal';
     $where = array();
     if (!empty($condition['orgid']) && !empty($condition['userid'])) {
         $where[] = 'user_id = ' . $this->_db->quote($condition['userid']);
         $where[] = 'org_id = ' . $this->_db->quote($condition['orgid']);
     }
     if (!$where) {
         return null;
     }
     $where = implode(' AND ', $where);
     $sql = "SELECT {$columns} FROM {$table} WHERE {$where} LIMIT 0, 1";
     $record = $this->_db->fetchRow($sql);
     if (!$record) {
         return null;
     }
     return Oray_Dao::record('Dao_Md_User_Record_Option', $record);
 }
Ejemplo n.º 29
0
 /**
  * 获取联系人记录
  * SELECT contact_id AS contactid, unique_id AS uniqueid, true_name AS truename, pinyin, email, mobile,
  * properties, memo, affinity, last_contact_time AS lastcontacttime, groups
  * FROM td_contact
  * WHERE contact_id = ? AND unique_id = ?
  * LIMIT 1
  *
  * @param array $condition
  * @param array $filter
  * @return Dao_Td_Contact_Record_Contact
  */
 public function getContact(array $condition, $filter = null)
 {
     $table = 'td_contact';
     $columns = 'contact_id AS contactid, unique_id AS uniqueid, true_name AS truename, pinyin, email, mobile, ' . 'properties, memo, affinity, last_contact_time AS lastcontacttime, groups, from_user AS fromuser';
     $where = array();
     if (!empty($condition['contactid'])) {
         $where[] = 'contact_id = ' . $this->_db->quote($condition['contactid']);
     }
     if (!empty($condition['uniqueid'])) {
         $where[] = 'unique_id = ' . $this->_db->quote($condition['uniqueid']);
     }
     if (!empty($condition['email'])) {
         $where[] = 'email = ' . $this->_db->quote($condition['email']);
     }
     if (!empty($condition['truename'])) {
         $where[] = 'true_name = ' . $this->_db->quote($condition['truename']);
     }
     if (!empty($condition['fromuser'])) {
         $where[] = 'from_user = '******'fromuser'] ? 1 : 0;
     }
     if (!$where) {
         return false;
     }
     if (isset($filter['isshow'])) {
         $where[] = 'is_show = ' . $filter['isshow'] ? 1 : 0;
     } else {
         $where[] = 'is_show = 1';
     }
     $where = implode(' AND ', $where);
     $sql = "SELECT {$columns} FROM {$table} WHERE {$where} LIMIT 1";
     try {
         $record = $this->_db->fetchRow($sql);
         if (!$record) {
             return null;
         }
         return Oray_Dao::record('Dao_Td_Contact_Record_Contact', $record);
     } catch (Zend_Db_Exception $e) {
         $this->_catchException($e, __METHOD__);
         return null;
     }
 }
Ejemplo n.º 30
0
 /**
  * 获取部门信息
  *
  * @param array $condition
  * @param array $filter
  * @return Dao_Md_Department_Record_Department
  */
 public function getDepartment(array $condition, $filter = null)
 {
     $table = 'md_department';
     $columns = 'org_id AS orgid, dept_id AS deptid, dept_name AS deptname, parent_dept_id AS parentid, order_num AS ordernum, moderators';
     $where = array();
     if (isset($condition['orgid'])) {
         $where[] = 'org_id = ' . $this->_db->quote($condition['orgid']);
     }
     if (isset($condition['deptid'])) {
         $where[] = 'dept_id = ' . $this->_db->quote($condition['deptid']);
     }
     if (!$where) {
         return null;
     }
     $where = implode(' AND ', $where);
     $sql = "SELECT {$columns} FROM {$table} WHERE {$where} LIMIT 1";
     $record = $this->_db->fetchRow($sql);
     if (!$record) {
         return null;
     }
     return Oray_Dao::record('Dao_Md_Department_Record_Department', $record);
 }