濮阳杆衣贸易有限公司

主頁 > 知識庫 > ajax實時任務(wù)提示功能的實現(xiàn)代碼第1/2頁

ajax實時任務(wù)提示功能的實現(xiàn)代碼第1/2頁

熱門標簽:廣西ai語音電銷機器人哪家好 蓄意標記地圖標注 莆田防封電銷卡價格 辦理一個400電話多少錢 接聽電話機器人哪有 如何用地圖標注各分公司 信貸電銷機器人有用嗎 察縣地圖標注 電銷機器人適用范圍
項目代碼結(jié)構(gòu)見 我之前寫的[EXT/FCKEditor 集成 -- AJAX UI -- 一種web開發(fā)的新的思維,要及時轉(zhuǎn)換思想]一文.
中的
├─taskofpig
│ ├─Controller
│ ├─Dao
│ ├─js
│ ├─music
│ ├─tpl
│ ├─tpl_c
│ └─_log
項目代碼如下:
db.sql
SET FOREIGN_KEY_CHECKS=0;
-- ----------------------------
-- Table structure for task
-- ----------------------------
CREATE TABLE `task` (
`id` int(11) NOT NULL,
`title` varchar(100) collate utf8_unicode_ci NOT NULL,
`desc` text collate utf8_unicode_ci,
`date` datetime NOT NULL,
`created` int(11) default NULL,
`updated` int(11) default NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- ----------------------------
-- Table structure for task_seq
-- ----------------------------
CREATE TABLE `task_seq` (
`id` int(11) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
/ucren/taskofpig/index.php
?php
//設(shè)置正確的時區(qū)
date_default_timezone_set("Asia/Shanghai");
define('TASKOFPIG_DIR',dirname(__FILE__)) ;
require('../phplibs/FLEA/FLEA.php');
// 對$GLOBALS[G_FLEA_VAR]['CLASS_PATH'] 進行配置
FLEA::import(TASKOFPIG_DIR); //將當(dāng)前目錄加入到環(huán)境變量中
FLEA::loadAppInf('appConfig.php') ; //將配置文件單獨分出來,容易維護
FLEA::init();
// 由于 FLEA_Db_TableDataGateway 并不是自動載入的,因此需要明確載入
FLEA::loadClass('FLEA_Db_TableDataGateway');
FLEA::runMVC();
?>
/ucren/taskofpig/appConfig.php
?php
// 對 $GLOBALS[G_FLEA_VAR]['APP_INF'] 進行配置
return array(
'dispatcher' => 'FLEA_Dispatcher_Simple' , //定制調(diào)度器 FLEA_Dispatcher_Auth
'controllerAccessor' => 'ctl' ,
'actionAccessor' => 'act' ,
'view' => 'FLEA_View_Smarty', //定制視圖
'viewConfig' => array(
'smartyDir' => '../phplibs/Smarty',
'template_dir' => './tpl',
'compile_dir' => './tpl_c',
'left_delimiter' => '%',
'right_delimiter' => '%>',
'debugging' => false
),
'dbDSN' => array( //定制數(shù)據(jù)庫連接參數(shù)
'driver' => 'mysql',
'host' => 'localhost',
'login' => 'dbuser',
'password' => 'dbpass',
'database' => 'dbname' ,
'charset ' => 'utf8'
) ,
'logFileDir' => './log' , //定制日志
'logFilename' => 'task_admin.log'
);
?>
/ucren/taskofpig/Dao/Table.php
?php
//生氣豬的任務(wù)計劃表
class Dao_TaskTable extends FLEA_Db_TableDataGateway
{
// 指定數(shù)據(jù)表名稱
var $tableName = 'task';
// 指定主鍵字段名
var $primaryKey = 'id';
}
?>
/ucren/taskofpig/Controller/Default.php
?php
FLEA::loadFile('Dao_Table.php',true) ;
FLEA::loadFile('FLEA_Ajax_JSON.php',true) ;
class Controller_Default extends FLEA_Controller_Action
{
var $smarty ;
function Controller_Default()
{
$this->smarty = $this->_getView();
$this->smarty->assign('sitename','任務(wù)計劃表 -- 生氣豬') ;
$this->smarty->assign('opname','任務(wù)列表') ;//缺省應(yīng)該在子模塊中更改值
}
function actionIndex()
{
$this->toModulePage(); //缺省顯示任務(wù)列表頁
}
//定義一個函數(shù)用于調(diào)用FCKeditor
function call_fck($input_name,$input_value,$w='800',$h='400')
{
include_once '../fckeditor/fckeditor.php';
$fcked = new FCKeditor($input_name) ;
$fcked->BasePath = '../fckeditor/';
$fcked->ToolbarSet = 'Default' ; //工具欄設(shè)置
$fcked->InstanceName = $input_name ;
$fcked->Width = $w;
$fcked->Height = $h;
$fcked->Value = $input_value;
$fck_area = $fcked->CreateHtml();
$this->smarty->assign('fck_area',$fck_area);
unset($fck_area) ;
unset($fcked) ;
}
function _showPage($tpl='taskofpig.main.html')
{
$this->smarty->display($tpl);
}
function actionAdd()
{
$this->addTask();
}
function actionUpdate()
{
$this->updateTask();
}
function deleteTask($id){
$row = array('id'=>$id);
$thisDao = new Dao_TaskTable() ;
$status = $thisDao->remove($row); //返回boolean值
unset($thisDao);
return $status ;
}
function listTask()
{
$thisDao = new Dao_TaskTable() ;
$rows = $thisDao->findAll(); //二維數(shù)組
foreach($rows as $row) //注意這里要傳引用
{
$row['desc'] = mb_substr($row['desc'],0,40,'UTF-8');
}
$this->smarty->assign('rowSet',$rows);
$this->_showPage();
}
function addTask()
{
$thisDao = new Dao_TaskTable() ;
$row = array(
'title' => $_REQUEST['title'],
'desc' => $_REQUEST['desc'],
'date' => $_REQUEST['date']
);
$commitId = $thisDao->create($row);
unset($thisDao);
echo "成功添加新任務(wù)";
redirect( url("Default"),1) ;
}
function updateTask()
{
$thisDao = new Dao_TaskTable() ;
$row = array(
'id' => $_REQUEST['id'],
'title' => $_REQUEST['title'],
'desc' => $_REQUEST['desc'],
'date' => $_REQUEST['date']
);
$commitId = $thisDao->update($row);
unset($thisDao);
echo "成功更新任務(wù)";
redirect( url("Default"),1) ;
}
function queryTask($id){
$thisDao = new Dao_TaskTable() ;
$row = $thisDao->find(array('id'=>$id));
unset($thisDao);
return $row ;
}
function queryTaskForDate($date=null)
{
$thisDao = new Dao_TaskTable() ; //'2008-08-17 07:42:29'
$row = $thisDao->find(array('date'=>date('Y-m-d H:i:s')));
unset($thisDao);
if (!empty($row))
{
$jsonobj = new Services_JSON();
echo $jsonobj->encode($row);
}
else
die(date('Y-m-d H:i:s'));
}
//任務(wù)流轉(zhuǎn)控制方法
function toModulePage()
{
if ($_REQUEST['op'] == 'search') {
$this->queryTaskForDate();
}
else if ($_REQUEST['op'] == 'add') {
$this->smarty->assign('opname','添加新任務(wù)') ;
$this->smarty->assign('taskTime',date('Y-m-d H:i:s')) ;
$this->call_fck('desc','');
$this->_showPage('taskofpig.add.html');
}
else if ($_REQUEST['op'] == 'del') {
if ( isset($_REQUEST['id']) is_numeric($_REQUEST['id']) )
$status = $this->deleteTask($_REQUEST['id']) ;
$this->listTask();
}
else if ($_REQUEST['op'] == 'edit') {
if ( isset($_REQUEST['id']) is_numeric($_REQUEST['id']) ){
$row = $this->queryTask($_REQUEST['id']) ;
}
$this->call_fck('desc',$row['desc']);
unset($row['desc']) ;
$this->smarty->assign('rowSet',$row);
$this->smarty->assign('opname','修改任務(wù)') ;
$this->_showPage('taskofpig.edit.html');
}
else { //列表
$this->listTask();
}
}
}
?>
12下一頁閱讀全文
您可能感興趣的文章:
  • ASP.NET搭配Ajax實現(xiàn)搜索提示功能
  • jquery ajax請求方式與提示用戶正在處理請稍等
  • php+ajax做仿百度搜索下拉自動提示框(有實例)
  • ajax 自動完成下拉框 自動提示位置問題
  • asp+ajax仿google搜索提示效果代碼
  • 使用jQuery全局事件ajaxStart為特定請求實現(xiàn)提示效果的代碼
  • ajax Suggest類似google的搜索提示效果
  • jquery formValidator插件ajax驗證 內(nèi)容不做任何修改再離開提示錯誤的bug解決方法
  • asp.net+js實現(xiàn)的ajax sugguest搜索提示效果
  • Ajax實現(xiàn)智能提示搜索功能

標簽:儋州 銅陵 張掖 延邊 鷹潭 阿拉善盟 益陽

巨人網(wǎng)絡(luò)通訊聲明:本文標題《ajax實時任務(wù)提示功能的實現(xiàn)代碼第1/2頁》,本文關(guān)鍵詞  ajax,實時,任務(wù),提示,功能,;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問題,煩請?zhí)峁┫嚓P(guān)信息告之我們,我們將及時溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無關(guān)。
  • 相關(guān)文章
  • 下面列出與本文章《ajax實時任務(wù)提示功能的實現(xiàn)代碼第1/2頁》相關(guān)的同類信息!
  • 本頁收集關(guān)于ajax實時任務(wù)提示功能的實現(xiàn)代碼第1/2頁的相關(guān)信息資訊供網(wǎng)民參考!
  • 推薦文章
    安新县| 鹤山市| 饶平县| 西畴县| 璧山县| 昂仁县| 蒲城县| 台湾省| 焉耆| 文化| 华亭县| 云阳县| 同德县| 溧水县| 安平县| 南昌市| 牟定县| 额敏县| 静乐县| 仪征市| 福鼎市| 江永县| 永德县| 越西县| 珠海市| 政和县| 涿鹿县| 通江县| 建阳市| 牙克石市| 武胜县| 平顶山市| 抚顺县| 图木舒克市| 高雄市| 平潭县| 阿克陶县| 丹东市| 益阳市| 大港区| 临沭县|