/**
  * 生成招聘信息报表
  *
  * @access public
  * @param int $startTime
  * @param int $endTime
  * @return array
  */
 public function recruitment($startTime, $endTime)
 {
     #获取时间段内产生的招聘信息
     $userList = F::db()->query('select user_id from user_tag where tag_id = ? and bind_time between ? and ?', array(self::CANdDIDATE_TAG_ID, date('Y-m-d H:i:s', $startTime), date('Y-m-d H:i:s', $endTime)))->fetch_column_all('user_id');
     #计算参加初试人数/参加复试人数/通过招聘人数/入职人数
     $returnData = array('first' => 0, 'second' => 0, 'success' => 0, 'entry' => 0);
     $returnDataDetail = array('first' => array(), 'second' => array(), 'success' => array(), 'entry' => array());
     foreach ($userList as $key => $value) {
         $eventList = F::db()->fetch_all('select * from event where user_id = ? and status = 1', array($value));
         $auditionInfo = $this->auditionModel->seachById($value);
         $returnData['first']++;
         $returnDataDetail['first'][$value] = $auditionInfo;
         foreach ($eventList as $eventIndex => $eventValue) {
             if ($eventValue['content'] == '#复试 @王则琼') {
                 $returnData['second']++;
                 $returnDataDetail['second'][$value] = $auditionInfo;
             }
         }
         if ($this->tagModel->userHadTagById($value, self::INTERVIEW_SUCCESS)) {
             $returnData['success']++;
             $returnDataDetail['success'][$value] = $auditionInfo;
         }
         if ($this->tagModel->userHadTagById($value, self::ENTRY)) {
             $returnData['entry']++;
             $returnDataDetail['entry'][$value] = $auditionInfo;
         }
         unset($eventList);
         unset($auditionInfo);
     }
     return array('rate' => $returnData, 'detail' => $returnDataDetail);
 }
Exemple #2
0
 /**
  * 更新用户信息
  * 
  * @access public
  * @param int $userId
  * @param array $updateInfo
  */
 public function update($userId, $updateInfo)
 {
     unset($updateInfo['add']);
     unset($updateInfo['update']);
     unset($updateInfo['addParam']);
     unset($updateInfo['updateParam']);
     $nickname = $updateInfo['username'];
     $phoneNum = $updateInfo['phoneNum'];
     unset($updateInfo['username']);
     unset($updateInfo['phoneNum']);
     $updateInfoTmp = array();
     foreach ($updateInfo as $key => $value) {
         $updateInfoTmp[$key] = array($key => $this->tagModel->getUserProfileName($key), 'value' => $value);
     }
     F::db()->execute('update account set phone_num = ? where user_id = ?', array($phoneNum, $userId));
     F::db()->execute('update user_profile set nickname = ?, user_profile = ?, update_time = ? where user_id = ?', array($nickname, serialize($updateInfoTmp), date('Y-m-d H:i:s'), $userId));
 }
Exemple #3
0
 private function bindTagByString($event, $eventId)
 {
     preg_match_all('/#([^#^\\s^:]{1,})([\\s\\:\\,\\;]{0,1})/', $event, $result);
     $this->tagModel = F::load_model('tag', array());
     foreach ($result[1] as $value) {
         $tagId = $this->tagModel->getTagIdByName($value);
         $this->bindTag($tagId, $eventId);
     }
 }
 private function isProjectTag($value)
 {
     $allProjectTag = $this->tagModel->getALLProjectInfo();
     $allProjectTagArray = array();
     foreach ($allProjectTag as $allProjectTagIndex) {
         $allProjectTagArray[] = $allProjectTagIndex['name'];
     }
     unset($allProjectTag);
     return in_array($value, $allProjectTagArray) ? TRUE : FALSE;
 }
Exemple #5
0
 public static function run(array $context)
 {
     self::set('categories', category_model::get_all());
     self::set('tags', tag_model::get_all(array(array('refer_count' => 'DESC'), 1, 10)));
     $comments = comment_model::get_all(array(array('id' => 'DESC'), 1, 10));
     binder::bind($comments, 'belongs_to', 'post');
     self::set('comments', $comments);
     self::set('links', link_model::get_all());
     self::render();
 }
Exemple #6
0
 public static function index_action()
 {
     // 呈现
     $page_size = 4;
     $order_limit = array(array('id' => 'DESC'), g_int('page', 1), $page_size);
     $tag_name = g_str('tag');
     $posts_binder = function (&$posts) {
         binder::bind($posts, 'belongs_to', 'member');
         binder::bind($posts, 'belongs_to', 'category');
         binder::bind($posts, 'many_many', 'tag', array('post_tag', 0));
     };
     if ($tag_name !== '') {
         $tag = tag_model::get_one(array('name' => $tag_name));
         if ($tag === null) {
             $pager = [];
             $posts = [];
         } else {
             $post_ids = [];
             foreach (post_tag_model::get(array('tag_id' => $tag->id)) as $post_tag) {
                 $post_ids[] = (int) $post_tag->post_id;
             }
             list($pager, $posts) = post_model::pager_by_ids($post_ids, $order_limit);
             $posts_binder($posts);
             $pager['target'] = array('post/index', array('tag' => $tag_name));
         }
     } else {
         $category_id = g_int('category_id', 0);
         if ($category_id === 0) {
             list($pager, $posts) = post_model::pager_all($order_limit);
             $posts_binder($posts);
             $pager['target'] = 'post/index';
         } else {
             list($pager, $posts) = post_model::pager(array('category_id' => $category_id), $order_limit);
             $posts_binder($posts);
             $pager['target'] = 'post/index?category_id=' . $category_id;
         }
     }
     self::set('pager', $pager);
     self::set('posts', $posts);
     self::set('logined', visitor::has_role('member'));
     self::show_page('', 'four');
 }
Exemple #7
0
 /**
  * 删除事件
  *
  * @access public
  * @param int $userId
  * @param int $eventId
  * @return void
  */
 public function deleteEvent($userId, $eventId)
 {
     #判断删除权限
     $eventInfo = $this->getEventInfo($eventId);
     if ($eventInfo['createUserId'] != $userId) {
         throw new Exception('只有事件创建者才可删除.', 203);
     }
     #删除事件
     F::db()->execute('update event set status = 0 where id = ?', array($eventId));
     #判断删除事件后是否依然具有相关标签信息
     preg_match_all('/#([^#^\\s^:]{1,})([\\s\\:\\,\\;]{0,1})/', $eventInfo['eventContent'], $result);
     foreach ($result[0] as $eventTagIndex) {
         $eventTagIndex = str_replace('\'', '', $eventTagIndex);
         $exist = F::db()->query('select id from event where content like ' . "'%{$eventTagIndex}%'" . ' and user_id = ? and status = 1 limit 1', array($eventInfo['userId']))->fetch_column('id');
         if (!$exist) {
             #去除相关标签
             $tagName = str_replace('#', '', $eventTagIndex);
             $tagId = $this->tagModel->getTagIdByName($tagName);
             $this->unbindTag($eventInfo['userId'], $tagId);
         }
     }
     unset($eventInfo);
 }
Exemple #8
0
 public static function delete_tags_for_post(post_model $post)
 {
     $post_id = $post->id;
     $post_tags = post_tag_model::get(array('post_id' => $post_id));
     if ($post_tags === []) {
         return;
     }
     $tag_ids = [];
     foreach ($post_tags as $post_tag) {
         $tag_ids[] = (int) $post_tag->tag_id;
     }
     post_tag_model::del(array('post_id' => $post_id));
     tag_model::dec_by_ids(array('refer_count' => 1), $tag_ids);
     tag_model::del(array('refer_count' => 0));
 }
 /**
  * 更新联系人信息
  * 
  * @access public
  * @return void
  */
 public function update()
 {
     $this->checkAccessToken();
     $this->params = $this->require_params(array('id'));
     $userId = $this->params['id'];
     unset($this->params['id']);
     unset($this->params['accessToken']);
     unset($this->params['r']);
     $this->returnData = $this->contactModel->getContactProfile($userId);
     unset($this->returnData['id']);
     unset($this->returnData['tagList']);
     unset($this->returnData['acctionList']);
     $requestTagArray = array();
     foreach ($this->params as $key => $value) {
         if ($key == 'username' && $value != $this->returnData['username']) {
             if ($this->returnData['username']) {
                 $this->params['update'] = 1;
                 $this->params['updateParam'][] = array('姓名', $value);
             } else {
                 $this->params['add'] = 1;
                 $this->params['addParam'][] = array('姓名', $value);
             }
         }
         if ($key == 'phoneNum' && $value != $this->returnData['phoneNum']) {
             if ($this->returnData['username']) {
                 $this->params['update'] = 1;
                 $this->params['updateParam'][] = array('手机号', $value);
             } else {
                 $this->params['add'] = 1;
                 $this->params['addParam'][] = array('手机号', $value);
             }
         }
         if ($key != 'username' && $key != 'phoneNum') {
             $requestTagArray[] = $this->tagModel->getUserProfileName($key);
         }
         if (!isset($this->returnData['userProfile'][$key]) && $key != 'username' && $key != 'phoneNum') {
             $this->params['add'] = 1;
             $this->params['addParam'][] = array($this->tagModel->getUserProfileName($key), $value);
         }
         if (isset($this->returnData['userProfile'][$key]['value']) && $value != $this->returnData['userProfile'][$key]['value']) {
             $this->params['update'] = 1;
             $this->params['updateParam'][] = array($this->returnData['userProfile'][$key][$key], $value);
         }
     }
     $this->params['add'] = $this->params['add'] ? $this->params['add'] : 0;
     $this->params['update'] = $this->params['update'] ? $this->params['update'] : 0;
     $this->contactModel->update($userId, $this->params);
     if ($this->params['add']) {
         $addEventContent = '新增信息';
         foreach ($this->params['addParam'] as $addIndex) {
             $addEventContent .= ' ' . '#' . $addIndex[0] . ' ' . $addIndex[1];
         }
     }
     if ($this->params['update']) {
         $updateEventContent = '更新信息';
         foreach ($this->params['updateParam'] as $updateIndex) {
             $updateEventContent .= ' ' . '#' . $updateIndex[0] . ' ' . $updateIndex[1];
         }
     }
     $this->userModel->createEvent($GLOBALS['userId'], $userId, $addEventContent . ' ' . $updateEventContent, '', self::SYSTEM_EVENT);
     foreach ($requestTagArray as $value) {
         $this->userModel->bindTag($userId, $value);
     }
     $this->userLog($GLOBALS['userId'], __CLASS__ . '/' . __FUNCTION__, serialize($this->params));
     F::rest()->show_result();
 }
Exemple #10
0
 /**
  * 获取全部项目信息列表
  *
  * @access public
  * @return array
  */
 public function getALLProjectInfo()
 {
     $this->checkAccessToken();
     $this->returnData = $this->tagModel->getALLProjectInfo();
     F::rest()->show_result($this->returnData);
 }