function index() { need_login('page'); $type = intval($this->getGet('type', '1')); $page = intval($this->getGet('page', 1)); $deleted_albums = $this->mdl_album->get_trash_count(); $deleted_photos = $this->mdl_photo->get_trash_count(); if ($deleted_albums <= 0 && $deleted_photos <= 0) { trash_status(2); $this->output->set('isempty', true); } else { if ($type == 1) { $data = $this->mdl_album->get_trash($page); if (is_array($data['ls'])) { foreach ($data['ls'] as $k => $v) { if ($v['cover_id']) { $cover_info = $this->mdl_photo->get_info($v['cover_id'], 'thumb'); if ($cover_info) { $data['ls'][$k]['cover_path'] = $cover_info['thumb']; } else { $data['ls'][$k]['cover_id'] = 0; } } } } } elseif ($type == 2) { $data = $this->mdl_photo->get_trash($page); } $pageurl = site_link('trash', 'index', array('type' => $type, 'page' => '[#page#]')); $page_obj =& loader::lib('page'); $pagestr = $page_obj->fetch($data['total'], $data['current'], $pageurl); $this->output->set('isempty', false); $this->output->set('pagestr', $pagestr); $this->output->set('data', $data['ls']); $this->output->set('deleted_albums', $deleted_albums); $this->output->set('deleted_photos', $deleted_photos); $this->output->set('type', $type); } //面包屑 $crumb_nav = array(); $crumb_nav[] = array('name' => lang('recycle')); $this->page_crumb($crumb_nav); $page_title = lang('recycle') . ' - ' . $this->setting->get_conf('site.title'); $page_keywords = $this->setting->get_conf('site.keywords'); $page_description = $this->setting->get_conf('site.description'); $this->page_init($page_title, $page_keywords, $page_description); $this->render(); }
function trash_batch($ids) { if (!is_array($ids)) { return false; } $in_sql = ''; foreach ($ids as $i) { $in_sql .= intval($i) . ','; } $in_sql = trim($in_sql, ','); $this->db->update('#@albums', 'id in (' . $in_sql . ')', array('deleted' => 1)); if (!$this->db->query()) { return false; } trash_status(1); return true; }
function trash_batch($ids) { if (!is_array($ids)) { return false; } $info = $this->get_info(intval($ids[0])); $in_sql = ''; foreach ($ids as $i) { $in_sql .= intval($i) . ','; } $in_sql = trim($in_sql, ','); $this->db->update('#@photos', 'id in (' . $in_sql . ')', array('deleted' => 1)); if (!$this->db->query()) { return false; } trash_status(1); $album_mdl =& loader::model('album'); $album_mdl->update_photos_num($info['album_id'], false); $album_mdl->check_repare_cover($info['album_id']); return true; }