/** Possible actions for a testsurvey: edit, view scores, delete */
 function testsurvey_actions($testsurvey_id)
 {
     $inspect_link = anchor('testsurvey/get/' . $testsurvey_id, img_zoom('testsurvey'));
     $find_link = anchor('testsurvey/find/' . $testsurvey_id, img_email(lang('testinvite')));
     $edit_link = anchor('testsurvey/edit/' . $testsurvey_id, img_edit());
     $delete_link = anchor('testsurvey/delete/' . $testsurvey_id, img_delete(), warning(lang('sure_delete_testsurvey')));
     return implode(' ', array($inspect_link, $find_link, $edit_link, $delete_link));
 }
 public function image_edit()
 {
     $rotate = I('rotate');
     $zoom = I('zoom');
     $tmp_url = I('tmp_url');
     // 这个只是缓存的图片路径
     /**
      * 因为连续的对图片进行旋转、缩放等,图片的质量会下降
      * 所以每次都是获取要操作的参数,然后拿原来的图片重新复制一张缓存图片,对其操作
      */
     $real_url = str_replace('_tmp.', '.', $tmp_url);
     copy($real_url, $tmp_url);
     // 执行函数
     // imgEdit($tmp_url, $rotate, $zoom);
     if ($rotate) {
         img_rotate($tmp_url, $rotate);
     }
     if ($zoom != 1) {
         img_zoom($tmp_url, $zoom);
     }
 }
Example #3
0
 /**
  * @author: liaoxianwen@ymt360.com
  * @description 广告列表
  */
 public function lists()
 {
     $site_id = C('app_sites.chu.id');
     $status = C('status.common.success');
     // 查询所属城市
     if (!empty($this->post['pos_id'])) {
         $pos_id = intval($this->post['pos_id']);
     } else {
         $this->_return_json(array('status' => C('tips.code.op_failed'), 'msg' => '广告位id没有标注'));
     }
     if (!isset($this->post['locationId'])) {
         $location_id = C('open_cities.beijing.id');
     } else {
         $location_id = $this->post['locationId'];
     }
     // 检测用户是否已经登录,
     // 登录用户不允许切换城市
     // 优先取登录用户的所在城市
     $cur = $this->userauth->current(TRUE);
     // 增加是否需要登录的来判断
     $need_login = array(0);
     if ($cur) {
         $location_id = $cur['province_id'];
         $need_login = array(0, 1);
     }
     $post = array('where' => array('status' => $status, 'location_id' => $location_id, 'site_id' => $site_id, 'in' => array('need_login' => $need_login), 'customer_type' => !empty($cur['customer_type']) ? $cur['customer_type'] : C('customer.type.normal.value')));
     $data = $this->format_query('/ads/get_valid_ads_list', $post);
     $status = empty($data['list']) ? FALSE : TRUE;
     if ($status) {
         $data['list'] = $this->_deal_by_pos_id($data, $pos_id, $cur);
         $data['list'] = img_zoom($data['list'], '-950-500');
     }
     if ($status && isset($data['list'])) {
         $response = $data;
     } else {
         $response = array('status' => C('tips.code.op_success'), 'list' => array(), 'msg' => '没有广告');
     }
     $this->_return_json($response);
 }
 private function get_image_info($pic_ids, $zoom = '-30-')
 {
     $this->load->helper('img_zoom');
     $images = array();
     if (!$pic_ids) {
         return array('raw_image' => array(), 'thumbnail' => array());
     }
     $pic_ids_array = explode(',', $pic_ids);
     $pic_urls_info = $this->MBucket->get_lists('*', array('in' => array('id' => $pic_ids_array)));
     if ($pic_urls_info) {
         $images['raw_image'] = $pic_urls_info;
         $images['thumbnail'] = img_zoom($pic_urls_info, $zoom);
     } else {
         $images['raw_image'] = array();
         $images['thumbnail'] = array();
     }
     return $images;
 }
 /**
  * Shows an age overview of all participants
  */
 public function age_overview()
 {
     // Get the number of months to look in the future
     $date = $this->input->post('date') ? $this->input->post('date') : output_date('now', TRUE);
     // Set up the table
     base_table();
     $this->table->set_heading('Leeftijd in maanden', 'Aantal actieve proefpersonen', 'Aantal dyslectisch', 'Aantal tweetalig', lang('actions'));
     // Calculate the number of participants per month, given the data
     foreach ($this->participantModel->get_participants_per_month($date) as $p) {
         $this->table->add_row($p->age, $p->count, $p->dyslexic, $p->multilingual, anchor('participant/age_overview_detail/' . $p->age . '/' . $date, img_zoom('participants')));
     }
     $data['table'] = $this->table->generate();
     $data['date'] = $date;
     $data['page_info'] = $this->load->view('participant_age_overview', $data, TRUE);
     $data['page_title'] = lang('participants');
     $this->load->view('templates/header', $data);
     $this->load->view('templates/table_view', $data);
     $this->load->view('templates/footer');
 }
 private function _format_img_info($products)
 {
     $list_sku_numbers = array_unique(array_column($products, 'sku_number'));
     // 获取sku信息
     $sku_lists = $this->CI->MSku->get_lists__Cache30('pic_ids, sku_number, net_weight', array('in' => array('sku_number' => $list_sku_numbers)));
     $sku_list_ids = array_column($sku_lists, 'pic_ids');
     $new_sku = array_column($sku_lists, NULL, 'sku_number');
     $buckets = [];
     if ($sku_list_ids) {
         $pic_ids = [];
         foreach ($sku_list_ids as $pic_id) {
             $pic_ids = array_unique(array_merge($pic_ids, explode(',', $pic_id)));
         }
         $buckets = $this->CI->MBucket->get_lists('id, pic_url', array('in' => array('id' => $pic_ids)), array('id' => 'ASC'));
         $buckets = array_column($buckets, NULL, 'id');
     }
     foreach ($products as &$product) {
         $product['net_weight'] = 0;
         if (isset($new_sku[$product['sku_number']])) {
             $product['pic_ids'] = $new_sku[$product['sku_number']]['pic_ids'];
             $product['net_weight'] = $new_sku[$product['sku_number']]['net_weight'];
             if (!empty($product['pic_ids']) && $buckets) {
                 $pic_ids_arr = explode(',', $product['pic_ids']);
                 $pictures = [];
                 foreach ($pic_ids_arr as $pic_id) {
                     if (isset($buckets[$pic_id])) {
                         $pictures[] = $buckets[$pic_id];
                     }
                 }
                 $product['pictures'] = img_zoom($pictures, '-240-');
                 $product['big_imgs'] = img_zoom($pictures, '-600-');
             }
         }
     }
     unset($product);
     return $products;
 }
 /** Returns the get link for a participation */
 function participation_get_link($participation)
 {
     return anchor('participation/get/' . $participation->id, img_zoom('participation'));
 }