public function index() { //分类列表 $categoryList = M('item_category')->select(); foreach ($categoryList as $key => $value) { $categoryList[$key]['url'] = U('Item/index', array('cid' => $value['id'])); } $this->categorylist = $categoryList; //搜索 $search = I('get.search'); if ($search) { $where['a.name'] = array('like', '%' . $search . '%'); } $cid = I('get.cid'); if ($cid) { $where['a.cid'] = $cid; $limit = item_category($cid, 'limit'); } $where['a.status'] = 1; $limit = default_data($limit, 10); //如果没有限制条数 默认10条 $count = D('User/item')->countList($where); // 统计有多少条数据 $Page = new \Think\Page($count, $limit); // 实例化分页类 传入总记录数和每页显示的记录数(20) $limit = $Page->firstRow . ',' . $Page->listRows; $Page->setConfig('prev', '上一页'); $Page->setConfig('next', '下一页'); $Page->setConfig('theme', '%UP_PAGE% %DOWN_PAGE%'); $show = $Page->show(); // 分页显示输出 // 进行分页数据查询 注意limit方法的参数要使用Page类的属性 $order = 'a.time desc'; $itemList = D('User/item')->loadList($where, $limit, $order); foreach ($itemList as $key => $value) { $itemList[$key]['url'] = U('Item/info', array('id' => $value['id'])); $itemList[$key]['last_time'] = gettime($value['end_time'] - time()); $itemList[$key]['category_name'] = item_category($value['cid'], 'name'); $itemList[$key]['success_rate'] = D('User/ItemWithOrder')->successRate($value['id']); //完成率 } //面包屑导航组装 $bread = '<ul class="x12 bread padding-big-top"> <li><a href="' . __ROOT__ . '/" class="icon-home"> 首页</a></li> <li><a href="' . item_category($cid, 'url') . '">' . item_category($cid, 'name') . '</a></li> </ul>'; $this->bread = $bread; $this->itemlist = $itemList; $this->page = $show; $this->display(); }
public function index() { $id = I('get.id'); // SEO标题 描述 关键词 $this->title = '新闻列表 - ' . C('sitename'); $this->keywords = C('keywords'); $this->description = C('desc'); if ($id) { $newsInfo = news_category($_GET['id']); // 如果有 pid seo标题 描述 关键词 $this->title = $newsInfo['title'] ? $newsInfo['title'] . ' - ' . C('sitename') : C('sitename'); $this->keywords = $newsInfo['keywords'] ? $newsInfo['keywords'] . ' - ' . C('keywords') : C('keywords'); $this->description = $newsInfo['description'] ? $newsInfo['description'] . ' - ' . C('desc') : C('desc'); $where['cid'] = $id; $limit = $newsInfo['limit']; // 获取栏目调用新闻数值 } //如果 没定义条数 默认10条 $limit = default_data($limit, 10); $news = D('Home/News'); // 实例化User对象 $where['a.status'] = 1; $count = $news->countList($where); // 统计有多少条数据 $Page = new \Think\Page($count, $limit); // 实例化分页类 传入总记录数和每页显示的记录数(20) $Page->setConfig('prev', '上一页'); $Page->setConfig('next', '下一页'); $Page->setConfig('theme', '%UP_PAGE% %DOWN_PAGE%'); $show = $Page->show(); $limit = $Page->firstRow . ',' . $Page->listRows; // 进行分页数据查询 注意limit方法的参数要使用Page类的属性 $newsList = $news->loadList($where); foreach ($newsList as $key => $value) { $newsList[$key]['url'] = U('News/info', array('id' => $value['id'])); } //面包屑导航组装 $bread = '<ul class="x12 bread padding-big-top"> <li><a href="' . __ROOT__ . '/" class="icon-home"> 首页</a></li> <li><a href="' . news_category($id, 'url') . '">' . news_category($id, 'name') . '</a></li> </ul>'; $this->bread = $bread; $this->newslist = $newsList; $this->page = $show; $this->display(); }
intro(); break; case "buildtablesquestion": buildtablesquestion(); break; case "buildtablesaction": buildtablesaction(); break; case "loadbasicaction": moveusersaction(); break; case "loadbasicquestion": moveusersquestion(); break; case "default_data": default_data(); break; case "moveusersaction": moveusersaction(); break; case "moveusersquestion": moveusersquestion(); break; case "finish": finish(); break; default: if (!$op) { intro(); } break;
/** * Email all admins when post status changes to pending * * @since 1.0.0 */ function author_send_email($new_status, $old_status, $post) { /** * */ //$settings = get_option('author_notifier_settings'); $settings = false; // Default values if ($settings === false) { $settings = default_data(); } $default_data = default_data(); $settings['message'] = array('cc_email' => $settings['message']['cc_email'] != '' ? $settings['message']['cc_email'] : $default_data['message']['cc_email'], 'bcc_email' => $settings['message']['bcc_email'] != '' ? $settings['message']['bcc_email'] : $default_data['message']['bcc_email'], 'from_email' => $settings['message']['from_email'] != '' ? $settings['message']['from_email'] : $default_data['message']['from_email'], 'subject_published' => $settings['message']['subject_published'] != '' ? $settings['message']['subject_published'] : $default_data['message']['subject_published'], 'subject_published_contributor' => $settings['message']['subject_published_contributor'] != '' ? $settings['message']['subject_published_contributor'] : $default_data['message']['subject_published_contributor'], 'subject_pending' => $settings['message']['subject_pending'] != '' ? $settings['message']['subject_pending'] : $default_data['message']['subject_pending'], 'content_published' => $settings['message']['content_published'] != '' ? $settings['message']['content_published'] : $default_data['message']['content_published'], 'content_published_contributor' => $settings['message']['content_published_contributor'] != '' ? $settings['message']['content_published_contributor'] : $default_data['message']['content_published_contributor'], 'content_pending' => $settings['message']['content_pending'] != '' ? $settings['message']['content_pending'] : $default_data['message']['content_pending'], 'share_links' => array('twitter' => $settings['message']['share_links']['twitter'], 'facebook' => $settings['message']['share_links']['facebook'], 'google' => $settings['message']['share_links']['google'], 'linkedin' => $settings['message']['share_links']['linkedin'])); // If status did not change if ($new_status == $old_status) { return null; } // Set all headers $headers = array(); if (isset($settings['message']['from_email']) && $settings['message']['from_email'] != '') { $headers[] = "From: " . $settings['message']['from_email'] . "\r\n"; } if (isset($settings['message']['cc_email']) && $settings['message']['cc_email'] != '') { $headers[] = "Cc: " . $settings['message']['cc_email'] . "\r\n"; } if (isset($settings['message']['bcc_email']) && $settings['message']['bcc_email'] != '') { $headers[] = "Bcc: " . $settings['message']['bcc_email'] . "\r\n"; } if (isset($settings['message']['share_links'])) { $check = false; foreach ($settings['message']['share_links'] as $link) { if ($link) { $share_links_check = true; } } } $url = get_permalink($post->ID); $share_links = ''; /** * Add sharing links are set */ if (isset($share_links_check) && $share_links_check) { $share_links = "\r\n\r\nShare Links\r\n"; if ($settings['message']['share_links']['twitter']) { $share_links .= "Twitter: " . esc_url('https://twitter.com/intent/tweet?url=' . $url) . "\r\n"; } if ($settings['message']['share_links']['facebook']) { $share_links .= "Facebook: " . esc_url('https://www.facebook.com/sharer/sharer.php?u=' . $url) . "\r\n"; } if ($settings['message']['share_links']['google']) { $share_links .= "Google+: " . esc_url('https://plus.google.com/share?url=' . $url) . "\r\n"; } if ($settings['message']['share_links']['linkedin']) { $share_links .= "LinkedIn: " . esc_url('https://www.linkedin.com/shareArticle?url=' . $url) . "\r\n"; } } // Notifiy Author that he/she has written a post if (in_array($post->post_type, $settings['post_types']) && $new_status == 'pending') { $url = get_permalink($post->ID); $edit_link = get_edit_post_link($post->ID, ''); $preview_link = get_permalink($post->ID) . '&preview=true'; $username = get_userdata($post->post_author); $author_email = $username->user_email; $subject = parse_tags($post, $username, $settings['message']['subject_pending']); $message = parse_tags($post, $username, $settings['message']['content_pending']); $message .= "\r\n\r\n"; $message .= "Dear {$username->display_name}," . "\r\n"; $message .= "Thank you for submitting your article to Charismedica. This is a confirmation email for your records. "; $message .= "Please find below information on your article. \r\n \r\n"; $message .= "ID: {$post->ID} \r\n"; $message .= "Title: {$post->post_title} \r\n"; $message .= "Abstract: {$post->post_content} \r\n\r\n"; $message .= "This is an automatically generated email. Please do not respond to it directly. "; $message .= "For questions regarding your submission, visit our contact page to get in touch with us. \r\n\r\n"; $message .= "Best regards, \r\n"; $message .= "Charismedica"; $result = wp_mail($author_email, $subject, $message, $headers); } // Notifiy Author when their work is published if (in_array($post->post_type, $settings['post_types']) && $new_status == 'publish') { // Notify Author that their post was published if (isset($settings['publish_notify']) && $settings['publish_notify'] == 'author' && $old_status == 'pending' && user_can($post->post_author, 'edit_posts') && !user_can($post->post_author, 'publish_posts')) { $username = get_userdata($post->post_author); $subject = parse_tags($post, get_userdata($post->post_author), $settings['message']['subject_published_contributor']); $message .= "Dear {$username->display_name}," . "\r\n"; $message .= "Congratulations! Your article was reviewed by our staff and accepted! "; $message .= "Please find below information on your article. \r\n \r\n"; $message .= "ID: {$post->ID} \r\n"; $message .= "Title: {$post->post_title} \r\n"; $message .= "Abstract: {$post->post_content} \r\n\r\n"; $message .= parse_tags($post, get_userdata($post->post_author), $settings['message']['content_published_contributor']); $message .= "This is an automatically generated email. Please do not respond to it directly. "; $message .= "For questions regarding your submission, visit our contact page to get in touch with us. \r\n\r\n"; $message .= "Best regards, \r\n"; $message .= "Charismedica"; $message .= $share_links; $result = wp_mail($username->user_email, $subject, $message, $headers); } // Notify All Admins or All Users } }