Beispiel #1
0
 /**
  * 
  * 整理活动内容
  * @param unknown_type $item
  */
 private function _arrange_event_item($item, $is_item = true, $list_user = false)
 {
     $arranged_item = array();
     if (!empty($item)) {
         $arranged_item['id'] = $item['eid'];
         $arranged_item['gid'] = $item['gid'];
         $arranged_item['type'] = $item['type'];
         $arranged_item['title'] = $item['title'];
         $arranged_item['summary'] = $item['summary'];
         $arranged_item['content'] = $item['content'];
         $arranged_item['organizer'] = array('id' => $item['organizer'], 'name' => sns::getrealname($item['organizer']), 'avatar' => sns::getavatar($item['organizer']));
         $arranged_item['start_time'] = $item['start_time'];
         $arranged_item['end_time'] = $item['end_time'];
         $event_images = $this->_list_event_image($item['eid']);
         $arranged_item['cover_image'] = array();
         if ($event_images['cover_image']) {
             $arranged_item['cover_image'] = $event_images['cover_image'];
         }
         $arranged_item['images'] = $event_images['list_image'] ? $event_images['list_image'] : array();
         $arranged_item['assemble_location'] = $item['assemble_location'] ? unserialize($item['assemble_location']) : array();
         $arranged_item['event_location'] = $item['event_location'] ? unserialize($item['event_location']) : array();
         $arranged_item['fee'] = $item['fee'];
         $arranged_item['deadline'] = $item['deadline'];
         $arranged_item['apply_desc'] = $item['apply_desc'];
         $arranged_item['private'] = $item['private'];
         $arranged_item['apply_doc'] = $this->model->getEventApplyDoc($item['eid']);
         $arranged_item['city'] = $this->model->getCityName($item['city']);
         if ($this->user_id) {
             $arranged_item['apply_type'] = $this->_check_apply_type($item['apply_type'], $item['eid'], $this->user_id);
         }
         $arranged_item['joined'] = array('number' => $this->model->getUserCount(array('eid' => $item['eid'], 'apply_type' => Kohana::config('event.apply_type.joined'))));
         $arranged_item['interested'] = array('number' => $this->model->getUserCount(array('eid' => $item['eid'], 'apply_type' => Kohana::config('event.apply_type.interested'))));
         if ($is_item) {
             $refused_user = $this->model->getEventUser($item['eid'], Kohana::config('event.apply_type.refused'));
             $arranged_item['refused']['number'] = $this->model->getUserCount(array('eid' => $item['eid'], 'apply_type' => Kohana::config('event.apply_type.refused')));
             $unconfirmed_user = $this->model->getEventUser($item['eid'], Kohana::config('event.apply_type.unconfirmed'));
             $arranged_item['unconfirmed']['number'] = $this->model->getUserCount(array('eid' => $item['eid'], 'apply_type' => Kohana::config('event.apply_type.unconfirmed')));
             //必须要登录情况下才能看到成员列表
             if ($list_user && $this->user_id) {
                 $joined_user = $this->model->getEventUser($item['eid'], Kohana::config('event.apply_type.joined'));
                 $arranged_item['joined']['user'] = $this->_arrange_user_list($joined_user, Kohana::config('event.apply_type.joined'), $item);
                 $interested_user = $this->model->getEventUser($item['eid'], Kohana::config('event.apply_type.interested'));
                 $arranged_item['interested']['user'] = $this->_arrange_user_list($interested_user, Kohana::config('event.apply_type.interested'), $item);
                 $arranged_item['refused']['user'] = $this->_arrange_user_list($refused_user, Kohana::config('event.apply_type.refused'), $item);
                 $arranged_item['unconfirmed']['user'] = $this->_arrange_user_list($unconfirmed_user, Kohana::config('event.apply_type.unconfirmed'), $item);
             }
         }
         $arranged_item['status'] = $this->_check_event_status($item['start_time'], $item['end_time'], $item['status'], $item['eid'], $item['deadline']);
     }
     return $arranged_item;
 }