PHPCMS v9构建模块 - 实例之企业服务模块
发布:smiling 来源: PHP粉丝网 添加日期:2014-10-20 16:42:12 浏览: 评论:0
先补一下课,没看过基本步骤的同学请看:
http://www.phpfensi.com/cms/20141020/7505.html
下面开始第一个实例,企业服务模块,这是个比较简单的模块,做一个抛砖的作用.
模块功能分析:企业服务,企业填写招聘申请表,管理审核之后,展示作为招聘通知的功能.
■1.文件分布
modules文件夹和model文件夹,这是我们的文件范围,在modules下建立qiye这个文件夹.
地址:F:\www\phpcms\modules\qiye
■2.实例图
上面的文件作用,在之前第一篇文章已经介绍过了,这里我再说一下,index.php 和 qiyi.php 的作用,分别是前台和后台的控制器control.
■3.前台控制器 index.php,class名必须与文件名一致
地址:F:\www\phpcms\modules\qiye\index.php
- <?php
- defined('IN_PHPCMS') or exit('No permission resources.');
- class index {
- private $db,$ip;
- function __construct() {
- pc_base::load_app_func('global');
- $this->db = pc_base::load_model('qiye_model');
- $this->ip = ip();
- $siteid = isset($_GET['siteid']) ? intval($_GET['siteid']) : get_siteid();
- define("SITEID",$siteid);
- }
- public function init() {
- $siteid = SITEID;
- $page = intval($_GET['page'])<=0 ? 1 : intval($_GET['page']);
- include template('qiye', 'index');
- }
- public function lists() {
- $siteid = SITEID;
- $page = intval($_GET['page']);
- $page = max($page,1);
- $r = $this->db->select(array('siteid'=>$siteid));
- if($r) extract($r);
- include template('qiye', 'list');
- }
- public function show(){
- $siteid = SITEID;
- $comid = intval($_GET['comid']);
- if(!$comid) showmessage(L('information_does_not_exist'),'blank');
- $r = $this->db->get_one(array('comid'=>$comid));
- if(!$r) showmessage(L('info_does_not_exists'),'blank');
- extract($r);
- include template('qiye', 'show');
- }
- public function reg(){
- if(isset($_POST['comname'])){
- //如果用户提交申请
- if($_POST['comname']==''){
- showmessage(L('qiye_noname'),"?m=qiye&c=index&a=reg&siteid=$siteid");
- }
- $db = pc_base::load_model('qiye_model');//加载模型
- //接收数据并存储
- $s = array();
- $num = array();
- $num = $_POST['zp_num'];
- $s['siteid'] = SITEID;
- $s['comname'] = safe_replace($_POST['comname']);
- $s['dw_name'] = safe_replace($_POST['dw_name']);
- $s['dw_department'] = safe_replace($_POST['dw_department']);
- $s['dw_area'] = safe_replace($_POST['dw_area']);
- $s['dw_property'] = safe_replace($_POST['dw_property']);
- $s['dw_economic'] = safe_replace($_POST['dw_economic']);
- $s['dw_contact'] = safe_replace($_POST['dw_contact']);
- $s['dw_zipcode'] = safe_replace($_POST['dw_zipcode']);
- $s['dw_address'] = safe_replace($_POST['dw_address']);
- $s['dw_telphone'] = safe_replace($_POST['dw_telphone']);
- $s['dw_fax'] = safe_replace($_POST['dw_fax']);
- $s['dw_email'] = safe_replace($_POST['dw_email']);
- $s['zp_hr'] = safe_replace($_POST['zp_hr']);
- $s['zp_tel'] = safe_replace($_POST['zp_tel']);
- $s['zp_email'] = safe_replace($_POST['zp_email']);
- $s['zp_property'] = safe_replace($_POST['zp_property']);
- $s['zp_industry'] = safe_replace($_POST['zp_industry']);
- $s['zp_post'] = safe_replace($_POST['zp_post']);
- $s['zp_area'] = safe_replace($_POST['zp_area']);
- $s['zp_major'] = safe_replace($_POST['zp_major']);
- $s['zp_salary'] = safe_replace($_POST['zp_salary']);
- $s['zp_num'] = array2string($num);
- $s['attr_commercial'] = safe_replace($_POST['attr_commercial']);
- $s['attr_information'] = safe_replace($_POST['attr_information']);
- $s['url'] = 'index.php?m=qiye&c=index&a=show&id=`id`';
- $s['ip'] = $this->ip;
- $s['inputtime'] = SYS_TIME;
- $s['updatetime'] = SYS_TIME;
- $comid = $db->insert($s,true);
- if($comid){
- showmessage(L('qiye_success'), "?m=qiye&c=index&a=init&siteid=$siteid");
- }
- } else {
- //默认显示申请页面
- pc_base::load_sys_class('form', '', 0);
- $SEO = seo(SITEID, '', L('qiye_apply'), '', '');
- include template('qiye', 'register');
- }
- }
- }
- ?>
■4.后台控制器 qiye.php,class名必须与文件名一致.
地址:F:\www\phpcms\modules\qiye\qiye.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)