/** * * @param type $c_id * @param type $is_star * @param type $per_page * @param type $search_word ===搜索关键字=== * @return type */ public function articleListData($c_id = 0, $is_star = 0, $per_page = 15, $search_word = '') { $cus_id = Auth::id(); if (!empty($search_word)) { if ($c_id) { $cus_data = new PrintController(); $c_ids = explode(',', $cus_data->getChirldenCid($c_id)); if ($is_star) { $article_list = Articles::whereIn('c_id', $c_ids)->where('title', 'like', '%' . $search_word . '%')->where('is_star', '=', $is_star)->orderBy('is_top', 'DESC')->orderBy('sort', 'ASC')->orderBy('created_at', 'DESC')->paginate($per_page); } else { $article_list = Articles::whereIn('c_id', $c_ids)->where('title', 'like', '%' . $search_word . '%')->orderBy('is_top', 'DESC')->orderBy('sort', 'ASC')->orderBy('created_at', 'DESC')->paginate($per_page); } } else { if ($is_star) { $article_list = Articles::where('cus_id', '=', $cus_id)->where('title', 'like', '%' . $search_word . '%')->where('is_star', '=', $is_star)->orderBy('is_top', 'DESC')->orderBy('sort', 'ASC')->orderBy('created_at', 'DESC')->paginate($per_page); } else { $article_list = Articles::where('cus_id', '=', $cus_id)->where('title', 'like', '%' . $search_word . '%')->orderBy('is_top', 'DESC')->orderBy('sort', 'ASC')->orderBy('created_at', 'DESC')->paginate($per_page); } } } else { if ($c_id) { $cus_data = new PrintController(); $c_ids = explode(',', $cus_data->getChirldenCid($c_id)); if ($is_star) { $article_list = Articles::whereIn('c_id', $c_ids)->where('is_star', '=', $is_star)->orderBy('is_top', 'DESC')->orderBy('sort', 'ASC')->orderBy('created_at', 'DESC')->paginate($per_page); } else { $article_list = Articles::whereIn('c_id', $c_ids)->orderBy('is_top', 'DESC')->orderBy('sort', 'ASC')->orderBy('created_at', 'DESC')->paginate($per_page); } } else { if ($is_star) { $article_list = Articles::where('cus_id', '=', $cus_id)->where('is_star', '=', $is_star)->orderBy('is_top', 'DESC')->orderBy('sort', 'ASC')->orderBy('created_at', 'DESC')->paginate($per_page); } else { $article_list = Articles::where('cus_id', '=', $cus_id)->orderBy('is_top', 'DESC')->orderBy('sort', 'ASC')->orderBy('created_at', 'DESC')->paginate($per_page); } } } $article_arr = $article_list->toArray(); if (count($article_arr['data'])) { foreach ($article_arr['data'] as $k => $v) { $moring = []; $article_arr['data'][$k]['c_name'] = Classify::where('id', $v['c_id'])->pluck('name'); $moring = Moreimg::where('a_id', $v['id'])->orderBy('sort')->lists('img'); array_unshift($moring, $v['img']); $article_arr['data'][$k]['img'] = $moring; unset($moring); } return $article_arr; } }
protected function save_model($modelName, $dataIn = array(), &$errors = array()) { return parent::save($modelName, $dataIn, $errors); }
protected function getPageName($base = null, $action = null) { return parent::getPageName('report definitions'); }
/** * 计算生成html文件的数量 * * @param array $pc_classify_ids pc栏目id * @param array $mobile_classify_ids 手机栏目id * @param array $pc_article_ids pc文章id * @param array $mobile_article_ids 手机文章id * @return int */ private function htmlPagecount($pc_classify_ids = [], $mobile_classify_ids = [], $pc_article_ids = [], $mobile_article_ids = []) { $template = new PrintController(); $page_count = 2; $pc_per_page = CustomerInfo::where('cus_id', $this->cus_id)->pluck('pc_page_count'); foreach ($pc_classify_ids as $id) { $c_ids = explode(',', $template->getChirldenCid($id)); $total = Articles::whereIn('c_id', $c_ids)->where('cus_id', $this->cus_id)->where('pc_show', '1')->count(); if ($total) { $page_count += ceil($total / $pc_per_page); } else { $page_count++; } } $mobileper_page = CustomerInfo::where('cus_id', $this->cus_id)->pluck('mobile_page_count'); foreach ($pc_classify_ids as $id) { $c_ids = explode(',', $template->getChirldenCid($id)); $total = Articles::whereIn('c_id', $c_ids)->where('cus_id', $this->cus_id)->where('mobile_show', '1')->count(); if ($total) { $page_count += ceil($total / $mobileper_page); } else { $page_count++; } } $page_count += count($pc_article_ids); $page_count += count($mobile_article_ids); return $page_count; }
/** * 获取搜索页数据 */ public function searchPreview($url, $type = 'pc') { $template = new PrintController('online', $type); return $template->sendCusAllData($url); }
/** * 推送 * * */ public function pushPrecent() { if (ob_get_level() == 0) { ob_start(); } $indexhtml = $this->homgepagehtml('pc'); $customer_data_get = CustomerPushfile::where('cus_id', $this->cus_id)->pluck('files'); if ($customer_data_get) { $new_data = 0; $customer_data = unserialize($customer_data_get); } else { $new_data = 1; $customer_data = []; } $mindexhtml = $this->homgepagehtml('mobile'); $pc_classify_ids = Classify::where('cus_id', $this->cus_id)->where('pc_show', 1)->lists('id'); $mobile_classify_ids = Classify::where('cus_id', $this->cus_id)->where('mobile_show', 1)->lists('id'); $pc_article_ids = Articles::where('cus_id', $this->cus_id)->where('pc_show', 1)->lists('id'); $mobile_article_ids = Articles::where('cus_id', $this->cus_id)->where('mobile_show', 1)->lists('id'); $count = $this->htmlPagecount($pc_classify_ids, $mobile_classify_ids, $pc_article_ids, $mobile_article_ids); $this->html_precent = 70 / $count; $categoryhtml = $this->categoryhtml($pc_classify_ids, 'pc'); $mcategoryhtml = $this->categoryhtml($mobile_classify_ids, 'mobile'); $articlehtml = $this->articlehtml($pc_article_ids, 'pc'); $marticlehtml = $this->articlehtml($mobile_article_ids, 'mobile'); $this->percent = 20 / $count; $path = public_path('customers/' . $this->customer . '/' . $this->customer . '.zip'); $template = new PrintController('online', 'mobile'); $quickbar_json = $template->quickBarJson(); $zip = new ZipArchive(); if ($zip->open($path, ZipArchive::CREATE) === TRUE) { $zip->addFile($indexhtml, 'index.html'); $nowpercent = $this->percent + $this->lastpercent; if (floor($nowpercent) != $this->lastpercent) { echo floor($nowpercent) . '%<script type="text/javascript">parent.refresh(' . floor($nowpercent) . ');</script><br />'; ob_flush(); flush(); } $this->lastpercent += 70 + $this->percent; $zip->addFile($mindexhtml, 'mobile/index.html'); $nowpercent = $this->percent + $this->lastpercent; if (floor($nowpercent) != floor($this->lastpercent)) { echo floor($nowpercent) . '%<script type="text/javascript">parent.refresh(' . floor($nowpercent) . ');</script><br />'; ob_flush(); flush(); } $this->lastpercent += $this->percent; $zip->close(); } //$customer_data = $this->compareZip($categoryhtml,$customer_data,'p','category',$path); //$customer_data = $this->compareZip($mcategoryhtml,$customer_data,'m','mobile/category',$path); //$customer_data = $this->compareZip($articlehtml,$customer_data,'pf','detail',$path); //$customer_data = $this->compareZip($marticlehtml,$customer_data,'mf','mobile/detail',$path); $this->compareZip($categoryhtml, $customer_data, 'p', 'category', $path); $this->compareZip($mcategoryhtml, $customer_data, 'm', 'mobile/category', $path); $this->compareZip($articlehtml, $customer_data, 'pf', 'detail', $path); $this->compareZip($marticlehtml, $customer_data, 'mf', 'mobile/detail', $path); if (90 > floor($this->lastpercent)) { echo '90%<script type="text/javascript">parent.refresh(90);</script><br />'; ob_flush(); flush(); } if ($zip->open($path, ZipArchive::CREATE) === TRUE) { $pc_dir = Template::where('website_info.cus_id', $this->cus_id)->Leftjoin('website_info', 'website_info.pc_tpl_id', '=', 'template.id')->pluck('name'); $mobile_dir = Template::where('website_info.cus_id', $this->cus_id)->Leftjoin('website_info', 'template.id', '=', 'website_info.mobile_tpl_id')->pluck('name'); $aim_dir = public_path("templates/{$pc_dir}/"); $maim_dir = public_path("templates/{$mobile_dir}/"); //$images_dir=public_path("customers/".$this->customer."/images/"); $this->addDir($aim_dir, $zip); //$this->addDir($images_dir,$zip,'images/'); $this->addDir($maim_dir, $zip, 'mobile/'); $zip->close(); $data = serialize($customer_data); if ($new_data) { $customerpushfile = new CustomerPushfile(); $customerpushfile->cus_id = $this->cus_id; $customerpushfile->files = $data; $customerpushfile->save(); } else { CustomerPushfile::where('cus_id', $this->cus_id)->update(['files' => $data]); } $customerinfo = Customer::find($this->cus_id); $ftp_array = explode(':', $customerinfo->ftp_address); $ftp_array[1] = isset($ftp_array[1]) ? $ftp_array[1] : '21'; $conn = ftp_connect($ftp_array[0], $ftp_array[1]); if ($conn) { ftp_login($conn, $customerinfo->ftp_user, $customerinfo->ftp_pwd); ftp_pasv($conn, 1); ftp_put($conn, "site.zip", $path, FTP_BINARY); ftp_put($conn, "unzip.php", public_path("packages/unzip.php"), FTP_ASCII); ftp_put($conn, "quickbar.json", public_path('customers/' . $this->customer . '/quickbar.json'), FTP_ASCII); ftp_put($conn, "mobile/quickbar.json", public_path('customers/' . $this->customer . '/quickbar.json'), FTP_ASCII); ftp_close($conn); } echo '100%<script type="text/javascript">parent.refresh(100);</script><br />'; Classify::where('cus_id', $this->cus_id)->where('pushed', 1)->update(['pushed' => 0]); Articles::where('cus_id', $this->cus_id)->where('pushed', 1)->update(['pushed' => 0]); $search_data = new TemplatesController(); $search_data->sendData(); $pc_domain = CustomerInfo::where('cus_id', $this->cus_id)->pluck('pc_domain'); @file_get_contents("{$pc_domain}/unzip.php"); } else { echo '打包失败'; } ob_end_flush(); }
} $usuarios = new LoginController(); $users = $usuarios->get($data); $app->render('usuarios.php', array('pacientes' => $paci, 'profesionales' => $profe, 'usuarios' => $users)); }); $app->get('/print', function () use($app) { $data = $app->request()->get(); if (empty($data['user'])) { unset($data['user']); } if (empty($data['tipo'])) { unset($data['tipo']); } $usuarios = new LoginController(); $users = $usuarios->get($data); $print = new PrintController(); $print->printUsuarios($users); }); $app->get('/alta', function () use($app) { $pacientes = new PacientesController(); $paci = $pacientes->get(); $profesionales = new ProfesionalesController(); $profe = $profesionales->get(); $app->render('usuarios_alta.php', array('pacientes' => $paci, 'profesionales' => $profe)); }); $app->post('/alta', function () use($app) { $data = $app->request()->post(); $usuarios = new LoginController(); $id_paciente = null; $id_profesional = null; if (!empty($data['id_paciente'])) {
/** * 生成搜索页面 */ public function sendData($type = 'pc') { $template = new PrintController('online', $type); if ($type == 'pc') { $publicdata = $this->pushpc; } else { $publicdata = $this->pushmobile; } ob_start(); $path = $type == 'pc' ? public_path('customers/' . $this->customer . '/search.html') : public_path('customers/' . $this->customer . '/mobile/search.html'); echo $template->searchPush($publicdata); file_put_contents($path, ob_get_contents()); ob_end_clean(); return $path; }
/** * 定义用户id、用户名、 * @param string $showtpye * @param string $type */ function __construct($showtpye = 'preview', $type = 'pc') { $this->showtype = $showtpye; $this->type = $type; $this->cus_id = Auth::id(); $this->customer = Auth::user()->name; if ($this->showtype == 'preview') { $this->source_dir = '/customers/' . $this->customer . '/images/'; //asset('customers/' . $this->customer . '/images/') . '/'; if ($this->type == 'mobile') { $this->domain = '/mobile'; //url() . '/mobile'; $this->tpl_id = WebsiteInfo::where('cus_id', $this->cus_id)->pluck('mobile_tpl_id'); $this->themename = DB::table('template')->leftJoin('website_info', 'website_info.mobile_tpl_id', '=', 'template.id')->where('website_info.cus_id', '=', $this->cus_id)->pluck('template.name'); $this->source_dir = '/customers/' . $this->customer . '/mobile/images/'; //asset('customers/' . $this->customer . '/mobile/images/') . '/'; self::$cus_domain = ''; //CustomerInfo::where('cus_id', $this->cus_id)->pluck('mobile_domain'); } else { $this->domain = ''; //url(); $this->tpl_id = WebsiteInfo::where('cus_id', $this->cus_id)->pluck('pc_tpl_id'); $this->themename = DB::table('template')->leftJoin('website_info', 'website_info.pc_tpl_id', '=', 'template.id')->where('website_info.cus_id', '=', $this->cus_id)->pluck('template.name'); self::$cus_domain = ''; //CustomerInfo::where('cus_id', $this->cus_id)->pluck('pc_domain'); } $this->site_url = '/templates/' . $this->themename . '/'; } else { if ($this->type == 'mobile') { $this->tpl_id = WebsiteInfo::where('cus_id', $this->cus_id)->pluck('mobile_tpl_id'); $this->themename = DB::table('template')->leftJoin('website_info', 'website_info.mobile_tpl_id', '=', 'template.id')->where('website_info.cus_id', '=', $this->cus_id)->pluck('template.name'); $mobile_domain = CustomerInfo::where('cus_id', $this->cus_id)->pluck('mobile_domain'); $mobile_domain = str_replace('http://', '', $mobile_domain); if (strpos($mobile_domain, '/mobile')) { $this->domain = '/mobile'; } //$this->domain = '';//CustomerInfo::where('cus_id', $this->cus_id)->pluck('mobile_domain'); } else { $this->tpl_id = WebsiteInfo::where('cus_id', $this->cus_id)->pluck('pc_tpl_id'); $this->themename = DB::table('template')->leftJoin('website_info', 'website_info.pc_tpl_id', '=', 'template.id')->where('website_info.cus_id', '=', $this->cus_id)->pluck('template.name'); $this->domain = ''; //CustomerInfo::where('cus_id', $this->cus_id)->pluck('pc_domain'); } self::$cus_domain = ''; // $this->domain; $this->site_url = $this->domain . '/'; $this->source_dir = '/images/'; //$this->domain . '/images/'; } }
public function save_response() { // sort the data out if (isset($this->_data['response'])) { $this->_data['TicketResponse']['body'] = $this->_data['response']; $this->_data['TicketResponse']['ticket_id'] = $this->_data['ticket_id']; $this->_data['TicketResponse']['type'] = 'site'; } $save = parent::save('TicketResponse', $this->_data['TicketResponse']); $ticket = new Ticket(); $ticket->load($this->_data['TicketResponse']['ticket_id']); $plateout = TicketingUtils::StatusPlate($ticket); $headers = array('From' => TicketingUtils::getReplyAddress($ticket)); $hours_data =& $this->_data['Hour']; if (isset($hours_data['duration']) && $hours_data['duration'] != 0) { if ($hours_data['duration_unit'] == 'days') { $hours_data['duration'] = $hours_data['duration'] * SystemCompanySettings::DAY_LENGTH; } // Calculate start time by working backward NB: Needs changing with date_format? $hours_data['start_time'] = date("d/m/Y H:i", time() - $hours_data['duration'] * 60 * 60); $hours_data['duration'] .= ' hours'; parent::save('Hour'); } // FIXME: If someone forces a file upload... I guess that causes this code to randomly send the file? if ($_FILES['file']['size'] > 0) { // Send MIME mail $boundary = 'EGS-Ticketing-System-' . base_convert(rand(1000, 9000), 10, 2); $headers['Content-Type'] = 'multipart/mixed; boundary=' . $boundary; $base64 = base64_encode(file_get_contents($_FILES['file']['tmp_name'])); // Yay, hand written MIME email! $body = "--{$boundary}\r\n" . "Content-Transfer-Encoding: 8bit\r\n" . "Content-Type: text/plain; charset=ISO-8859-1\r\n" . "\r\n" . $plateout . $this->_data['TicketResponse']['body'] . "\r\n" . "\r\n" . "--{$boundary}\r\n" . 'Content-Type: octet/stream; name="' . $_FILES['file']['name'] . '"' . "\r\n" . "Content-Transfer-Encoding: base64\r\n" . 'Content-Disposition: attachment; filename="' . $_FILES['file']['name'] . '"' . "\r\n" . "\r\n" . chunk_split($base64) . "\r\n" . "\r\n" . "--{$boundary}--\r\n" . "."; $errors = array(); $file = File::Factory($_FILES['file'], $errors, new File()); $file->save(); $ticketAttachment = TicketAttachment::Factory(array('ticket_id' => $this->_data['TicketResponse']['ticket_id'], 'file_id' => $file->id), $errors, new TicketAttachment()); $ticketAttachment->save(); } else { // No attachment, send plain text mail $body = $plateout . $this->_data['TicketResponse']['body']; } $header_string = ""; foreach ($headers as $header => $value) { $header_string .= $header . ': ' . $value . "\r\n"; } // FIXME: Do this further up if (!isset($this->_data['TicketResponse']['internal']) || isset($this->_data['TicketResponse']['internal']) && $this->_data['TicketResponse']['internal'] != 'on') { $recipients = TicketingUtils::GetRecipients($ticket); foreach ($recipients as $recipient) { mail($recipient, 're: [' . $ticket->ticket_queue_id . '-' . $ticket->id . '] ' . $ticket->summary, $body, $header_string); } } if (is_ajax()) { echo json_encode(array('success' => $save)); exit; } else { sendTo('Tickets', 'view', array('ticketing'), array('id' => $this->_data['TicketResponse']['ticket_id'])); } }
protected function getPageName($base = null, $action = null) { return parent::getPageName(empty($base) ? 'customer_services' : $base, $action); }
protected function getPageName($base = null, $action = null) { return parent::getPageName('uzLets'); }
protected function getPageName($base = null, $action = null) { return parent::getPageName('Customer Service Failure Codes'); }
protected function getPageName($base = null, $action = null) { return parent::getPageName(!empty($base) ? $base : $this->title, $action); }