PHPCMS v9构建模块 - 实例之企业服务模块
发布:smiling 来源: PHP粉丝网 添加日期:2014-10-20 16:42:12 浏览: 评论:0
- <?php
- defined('IN_PHPCMS') or exit('No permission resources.');
- pc_base::load_app_class('admin','admin',0);
- class qiye extends admin {
- private $db;
- function __construct() {
- parent::__construct();
- $this->db = pc_base::load_model('qiye_model');
- $siteid = isset($_GET['siteid']) ? intval($_GET['siteid']) : get_siteid();
- define("SITEID",$siteid);
- }
- //默认动作
- public function init() {
- $where = array('siteid'=>$this->get_siteid(),'status'=>0);
- $page = isset($_GET['page']) && intval($_GET['page']) ? intval($_GET['page']) : 1;
- $infos = $this->db->listinfo($where,$order = 'listorder DESC',$page, $pages = '9');
- $pages = $this->db->pages;
- extract($infos);
- include $this->admin_tpl('list');
- }
- public function show() {
- $comid = intval($_GET['comid']);
- if(!$comid) showmessage(L('information_does_not_exist'),'blank');
- $infos = $this->db->get_one(array('comid'=>$comid));
- if(!$infos) showmessage(L('info_does_not_exists'),'blank');
- extract($infos);
- include $this->admin_tpl('show');
- }
- public function list_pass() {
- $where = array('siteid'=>$this->get_siteid(),'status'=>1);
- $page = isset($_GET['page']) && intval($_GET['page']) ? intval($_GET['page']) : 1;
- $infos = $this->db->listinfo($where,$order = 'listorder DESC',$page, $pages = '9');
- $pages = $this->db->pages;
- extract($infos);
- include $this->admin_tpl('list_pass');
- }
- public function pass() {
- if((!isset($_GET['comid']) || emptyempty($_GET['comid'])) && (!isset($_POST['comid']) || emptyempty($_POST['comid']))) {
- showmessage(L('illegal_parameters'), HTTP_REFERER);
- } else {
- $comid = intval($_GET['comid']);
- if($comid < 1) return false;
- $result = $this->db->update(array('status'=>'1'),array('comid'=>$comid));
- $infos = $this->db->get_one(array('comid'=>$comid));
- if($result){
- if(is_email($infos['zp_email'])){
- pc_base::load_sys_func('mail');
- $siteinfo = siteinfo(SITEID);
- $sitename = $siteinfo['site_title'];
- $toemail = $infos['zp_email']; //发送通知邮件
- $subject = '信息审核通知';
- $message .= '尊敬的'.$infos['zp_hr'].':<br /> 您好!';
- $message .= '很高兴的通知您,您在'.date('Y年m月d日',$infos['inputtime']).'在我们网站['.$sitename.']发布的信息已经通过审核。';
- $message .= '<br /><br />祝好!<br /><br />-----------------------------------------<br />';
- $message .= '<font color=green>这是一封由系统发送的邮件,请勿回复此邮件!</font>';
- sendmail($toemail,$subject,$message);
- }
- exit('1');
- } else {
- exit('0');
- }
- }
- }
- public function listorder() {
- if(isset($_POST['dosubmit'])) {
- foreach($_POST['listorders'] as $comid => $listorder) {
- $this->db->update(array('listorder'=>$listorder),array('comid'=>$comid));
- }
- showmessage(L('operation_success'),HTTP_REFERER);
- }
- }
- public function delete() {
- if((!isset($_GET['comid']) || emptyempty($_GET['comid'])) && (!isset($_POST['comid']) || emptyempty($_POST['comid']))) {
- showmessage(L('illegal_parameters'), HTTP_REFERER);
- } else {
- if(is_array($_POST['comid'])){ //1.批量删除
- foreach($_POST['comid'] as $comid) {
- $this->db->delete(array('comid'=>$comid));
- //删除附件
- if(pc_base::load_config('system','attachment_stat')) {
- $this->attachment_db = pc_base::load_model('attachment_model');
- $this->attachment_db->api_delete($comid);
- }
- }
- showmessage(L('operation_success'),'?m=qiye&c=qiye');
- }else{ //2.单条删除
- $comid = intval($_GET['comid']);
- if($comid < 1) return false;
- $result = $this->db->delete(array('comid'=>$comid));
- //删除附件
- if(pc_base::load_config('system','attachment_stat')) {
- $this->attachment_db = pc_base::load_model('attachment_model');
- $this->attachment_db->api_delete($comid);
- }
- if($result){
- exit('1');
- showmessage(L('operation_success'),'?m=qiye&c=qiye');
- }else {
- exit('0');
- showmessage(L("operation_failure"),'?m=qiye&c=qiye');
- }
- }
- showmessage(L('operation_success'), HTTP_REFERER);
- }
- }
- public function setting() {
- include $this->admin_tpl('setting');
- }
- }
- ?>
■5.PC标签方法 qiye_tag.class.php,为模版数据调用而设置.
地址:F:\www\phpcms\modules\qiye\classes\qiye_tag.class.php
- <?php
- defined('IN_PHPCMS') or exit('No permission resources.');
- class qiye_tag {
- private $db;
- public function __construct() {
- $this->db = pc_base::load_model('qiye_model');
- }
- public function lists($data) {
- $siteid = $data['siteid'] ? intval($data['siteid']) : get_siteid();
- $sql = array('siteid'=>$siteid);
- $data = $this->db->select($sql, '*', $data['limit'], $data['order']);
- return $data;
- }
- public function pc_tag() {
- $sites = pc_base::load_app_class('sites','admin');
- $sitelist = $sites->pc_tag_list();
- return array(
- 'action'=>array('lists'=>L('lists', '', 'qiye')),
- 'lists'=>array(
- 'catid'=>array('name'=>L('catid', '', 'qiye'),'htmltype'=>'input_select_category','data'=>array('type'=>0),'validator'=>array('min'=>1)),
- 'order'=>array(
- 'name'=>L('sort', '', 'qiye'),
- 'htmltype'=>'select',
- 'data'=>array(
- 'id DESC'=>L('id_desc', '', 'qiye'),
- 'inputtime DESC'=>L('inputtime_desc', '', 'qiye'),
- 'updatetime DESC'=>L('updatetime_desc', '', 'qiye'),
- 'listorder ASC'=>L('listorder_asc', '', 'qiye')
- ) //phpfensi.com
- )
- ),
- );
- }
- }
- ?>
这里设置了一个方法,lists内容列表,在模版的时候调用如下:
{pc:qiye action="lists" catid="$catid" order="listorder desc" num="8"}
■6.函数方法库 functions,因为我这里都用到的是系统的方法,所以里面是空的.
■7.模块安装文件夹 地址 F:\www\phpcms\modules\qiye\install
7.1 语言文件 qiye.lang.php (我这里只做了中文的语言)
Tags: PHPCMS构建模块 PHPCMS企业模块
- 上一篇:PHPCMS v9构建模块
- 下一篇:phpcmsv9 分频道显示友情链接
相关文章
- ·PHPCMS v9构建模块(2014-10-20)
- ·phpcms v9 二次开发之构建模块全过程(2014-10-20)
- ·【phpcms-v9】自己动手构建一个企业服务模块(2014-10-23)
推荐文章
热门文章
最新评论文章
- 写给考虑创业的年轻程序员(10)
- PHP新手上路(一)(7)
- 惹恼程序员的十件事(5)
- PHP邮件发送例子,已测试成功(5)
- 致初学者:PHP比ASP优秀的七个理由(4)
- PHP会被淘汰吗?(4)
- PHP新手上路(四)(4)
- 如何去学习PHP?(2)
- 简单入门级php分页代码(2)
- php中邮箱email 电话等格式的验证(2)