Esempio n. 1
0
 public function build($name, $value = null, $attribs = null, $disable = false)
 {
     //$info = $this->_getInfo($name, $value, $attribs);
     //extract($info); // name, value, attribs, options, listsep, disable
     // build the element
     if ($disable) {
         // disabled
         $xhtml = $this->_hidden($name, $value) . htmlspecialchars($value);
     } else {
         // enabled
         $id = "dingdan_selector_" . $name;
         $attribs["id"] = $id;
         $sitePath = Pft_Config::getSiteRoot();
         $xhtml = $this->_getCommonHtml();
         $xhtml .= Pft_View_Helper::buildElmentByVartype("C", $name, $value, $attribs);
         //echo "<script>alert('aa');</script>";
         /*
                     $xhtml = '<input type="text"'
                            . ' name="' . htmlspecialchars($name) . '"'
                            . ' value="' . htmlspecialchars($value) . '"'
                            . $this->_htmlAttribs($attribs)
                            . ' />';*/
         $xhtml .= '<a href="#" class="btn" type="button" id="btnSelectCr" onclick="ddSelTool.show(  \'' . $attribs["id"] . '\', this,\'\',\'s0=\'+document.all.' . $name . '.value+\'\' );return false;">' . i18ntrans('#选') . '</a>';
     }
     return $xhtml;
 }
Esempio n. 2
0
 public function build($name, $value = null, $attribs = null, $disable = false)
 {
     //$info = $this->_getInfo($name, $value, $attribs);
     //extract($info); // name, value, attribs, options, listsep, disable
     // build the element
     if ($disable) {
         // disabled
         $xhtml = $this->_hidden($name, $value) . htmlspecialchars($value);
     } else {
         // enabled
         if (!isset($attribs["id"])) {
             $id = "person_selector_" . $name;
             $attribs["id"] = $id;
         }
         if (!isset($attribs["onclick"])) {
             $attribs["onclick"] = 'userSelTool.show( null, \'' . $attribs["id"] . '\', this, \'' . @$attribs["param"] . '\' );return false;';
             if (!isset($attribs["style"])) {
                 $attribs["style"] = 'cursor:pointer;';
             }
         }
         $sitePath = Pft_Config::getSiteRoot();
         $xhtml = $this->_getCommonHtml();
         $xhtml .= Pft_View_Helper::buildElmentByVartype("C", $name, $value, $attribs);
         /*
                     $xhtml = '<input type="text"'
                            . ' name="' . htmlspecialchars($name) . '"'
                            . ' value="' . htmlspecialchars($value) . '"'
                            . $this->_htmlAttribs($attribs)
                            . ' />';*/
         $xhtml .= '<a href="#" class="btn" type="button" id="btnSelectCr" onclick="userSelTool.show( null, \'' . $attribs["id"] . '\', this, \'' . @$attribs["param"] . '\' );return false;">' . i18ntrans('#选') . '</a>';
     }
     return $xhtml;
 }
Esempio n. 3
0
    /**
     * 使用yui-ext建立TableGrid
     * 
     * <code>
     * $grid->showMe( array('gridId'=>'sql_grid') );
     * Pft_View_Helper_Ext::buildTableGrid( 'sql_grid' );
     * </code>
     *
     * @param string $gridId grid的ID
     */
    public static function buildTableGrid($gridId)
    {
        if (!self::$_loadedTableGridLib) {
            ?>
<script src="<?php 
            echo Pft_Config::getSiteRoot();
            ?>
js/ext-1.0/tpm/TableGrid.js"></script>
<?php 
            self::$_loadedTableGridLib = true;
        }
        ?>
<script>
/*
 * Ext JS Library 1.0
 * Copyright(c) 2006-2007, Ext JS, LLC.
 * licensing@extjs.com
 * 
 * http://www.extjs.com/license
 */
Ext.onReady(function() {
	// create the grid
    var grid = new Ext.grid.TableGrid('<?php 
        echo $gridId;
        ?>
');
    grid.render();
});
</script>
<?php 
    }
Esempio n. 4
0
    public function build($name, $value = null, $attribs = null, $disable = false)
    {
        //$info = $this->_getInfo($name, $value, $attribs);
        //extract($info); // name, value, attribs, options, listsep, disable
        // build the element
        if ($disable) {
            // disabled
            $xhtml = $this->_hidden($name, $value) . htmlspecialchars($value);
        } else {
            // enabled
            if (!isset($attribs['id'])) {
                $id = "date" . mt_rand(1000, 9999);
                $attribs["id"] = $id;
            } else {
                $id = $attribs["id"];
            }
            $sitePath = Pft_Config::getSiteRoot();
            $xhtml = Pft_View_Helper::buildElmentByVartype("C", $name, $value, $attribs);
            $xhtml .= $this->_getCommonHtml();
            /*
                        $xhtml = '<input type="text"'
                               . ' name="' . htmlspecialchars($name) . '"'
                               . ' value="' . htmlspecialchars($value) . '"'
                               . $this->_htmlAttribs($attribs)
                               . ' />';*/
            $xhtml .= <<<EOT
<img id="dateButton_{$id}" src="{$sitePath}js/john/jscalendar/calendar.gif" border="0" align="absmiddle" style="cursor:pointer" />
<!--<input   name="start_date[{\$i}]" type="text" class="Input1" id="start_date[{\$i}]" value="{\$start_mren}" size="14" readonly/>-->
<script type="text/javascript">
    Calendar.setup({
        inputField     :    "{$id}",
EOT;
            if ($this->_showTimes) {
                $xhtml .= '
        ifFormat       :    "%Y-%m-%d %H:%M",
        showsTime      :    true,';
            } else {
                if ($this->_showTimeSecs) {
                    $xhtml .= '
        ifFormat       :    "%Y-%m-%d %H:%M:%S",
        showsTime      :    true,';
                } else {
                    $xhtml .= '
        ifFormat       :    "%Y-%m-%d",';
                }
            }
            $xhtml .= <<<EOT
        button         :    "dateButton_{$id}",
        singleClick    :    true,
        step           :    1
    });
</script>
EOT;
            /* $xhtml .= <<<EOT
                    <img id="dateButton_{$id}" src="{$sitePath}js/john/jscalendar/calendar.gif" border="0" align="absmiddle" style="cursor:pointer" onClick="Calendar.setDayHM(document.getElementById({$id}),0,'');"/>       
            EOT;*/
        }
        return $xhtml;
    }
Esempio n. 5
0
 /**
  * 获得 经过 组ID 偏移后的 RealEpollId 
  *
  * @param int $idOffset
  * @return int
  */
 public static function getRealEpollId($idOffset = 0)
 {
     if (defined('TQ_33')) {
         if (Pft_Config::getEpollGroupId()) {
             $epo = Pft_Config::getEpollGroupId() * 65536 * 256 + $idOffset;
         } else {
             $epo = 65536 * 256 + $idOffset;
         }
     } else {
         $epo = $idOffset;
     }
     return $epo;
 }
Esempio n. 6
0
 /**
  * 邮件模板函数
  *
  * @param unknown_type $model      模板名称
  * @param unknown_type $varname    替换数据
  */
 public static function formatMailBody($model, $searchname, $replcename)
 {
     $_searchname = array();
     $path = Pft_Config::getConfigPath() . "public/emailtemplates/" . $model;
     $str = file_get_contents($path);
     if (count($searchname) > 0) {
         foreach ($searchname as $val) {
             $_searchname[] = "<?\$" . $val . "?>";
         }
     }
     //return $str;
     $search = str_replace($_searchname, $replcename, $str);
     return $search;
 }
Esempio n. 7
0
 function uploadfileAction()
 {
     $result = array();
     if (isset($_FILES['Filedata'])) {
         $file = $_FILES['Filedata']['tmp_name'];
         $temp_file = iconv('utf-8', 'gbk', $_FILES['Filedata']['name']);
         $toFileFloder = Pft_Config::getCfg('PATH_ROOT') . "images/caixi/";
         if (!is_dir($toFileFloder)) {
             @mkdir($toFileFloder);
             @chmod($toFileFloder, 0777);
         }
         $toFile = $toFileFloder . $temp_file;
         if (move_uploaded_file($file, $toFile)) {
             //$_SESSION["uploadFile"]="./images/caixi/".$temp_file;
         } else {
             //$_SESSION["uploadFile"]='error';
         }
     }
     exit;
 }
Esempio n. 8
0
 public static function getAdodb($con_name = "propel")
 {
     /**
      * 数据库连结类:ADODB
      */
     $configuration = (include Pft_Config::getConfigPath() . "propel.conf.php");
     if (!isset($configuration['datasources'][$con_name])) {
         $con_name = $configuration['datasources']["default"];
     }
     $cfg = $configuration['datasources'][$con_name]['connection'];
     include_once Pft_Config::getLibPath(1) . "adodb/adodb.inc.php";
     $db_a = ADONewConnection("mysql");
     $ADODB_CACHE_DIR = Pft_Config::getRootPath() . "cache/adodb";
     $db_a->Connect($cfg["hostspec"] . ($cfg["port"] ? ":" . $cfg["port"] : ""), $cfg["username"], $cfg["password"], $cfg["database"]);
     $db_a->Execute("set names 'utf8'");
     //数据库字符编码设置
     $db_a->SetFetchMode(ADODB_FETCH_ASSOC);
     // 设置缓存有效时间为5分钟
     $db_a->cacheSecs = 300;
     return $db_a;
 }
Esempio n. 9
0
 function __construct($logFileName = "", $logPath = "")
 {
     if ($logFileName != "") {
         $this->_logFileName = $logFileName . date("Ymd") . ".log";
     } else {
         $this->_logFileName = date("Ymd") . ".log";
     }
     $this->_logPath = $logPath == "" ? Pft_Config::getLogPath() : $logPath;
     if (!file_exists($this->_logPath)) {
         mkdir($this->_logPath, 0777, true);
         @chmod($this->_logPath, 0777);
     }
     $this->_hLogFile = fopen($this->_logPath . $this->_logFileName, "a");
     @chmod($this->_logPath . $this->_logFileName, 0766);
     //$this->_startTime = $this->_microtime_float();
     if (defined('APP_START_TIME')) {
         $this->_startTime = (int) (APP_START_TIME * 1000);
     } else {
         $this->_startTime = $this->_microtime_float();
     }
     $this->_lastLogTime = $this->_startTime;
 }
Esempio n. 10
0
 /**
  * 载入语言串
  * 
  * @todo I18n优化 速度 设置语言的位置
  */
 private static function _loadStrings()
 {
     if (self::$isStringsLoaded) {
         return;
     }
     self::setLang(Pft_Session::getSession()->getLanguage());
     //include后 1.8 1.9 ms左右
     //include前 1.5 1.6 ms左右 include 还挺费时间...
     //考虑放到各个模块里..用到那个载入哪个? //这个更像php风格
     //还是放到一起一并载入?
     //先每个人用到的分开,最后合并
     $langPath = Pft_Config::getLangPath() . self::$lang . DIRECTORY_SEPARATOR;
     self::_loadLangFilesInDir($langPath);
     //载入备用目录的语言文件 //
     $langPath = Pft_Config::getLangPath(1) . self::$lang . DIRECTORY_SEPARATOR;
     self::_loadLangFilesInDir($langPath);
     /* 合并语言文件以后用下面这段代码,合并以前用上面那段
     		$str2s = include_once( Pft_Config::getLangPath()
     		                      .self::$lang
     		                      .DIRECTORY_SEPARATOR."lang.php" );
     		self::$strings = array_merge( self::$strings, $str2s);
     */
     self::$isStringsLoaded = true;
 }
Esempio n. 11
0
//Pft_Config 中用到 $_SESSION[MULTI_SITE_SESSION_NAME]
if (isset($_SESSION[MULTI_SITE_SESSION_NAME])) {
    $site = $_SESSION[MULTI_SITE_SESSION_NAME];
} else {
    $site = @$_REQUEST['site'];
    if (!$site) {
        $site = $_SERVER['HTTP_HOST'];
    }
    if (!is_dir($config_path . $site)) {
        $site = 'default';
    }
    $_SESSION[MULTI_SITE_SESSION_NAME] = $site;
}
require_once $config_path . "/loader.php";
Pft_Config::setCfg('PATH_APP', Pft_Config::getCfg('PATH_APP'), 1);
Pft_Config::setCfg('PATH_APP', dirname(__FILE__) . '/app/');
//========================================
/**
 * 环境准备完毕 程序开始
 */
Pft_Debug::addInfoToDefault('Pre dispatch.');
try {
    /**
     * 分发
     */
    $dispatch = new Pft_Dispatcher();
    $dispatch->dispatch();
} catch (Exception $e) {
    $code = $e->getCode();
    $errorInfo = $e->getMessage() . " at (" . $e->getFile() . " | Line:" . $e->getLine() . ") Code [" . $code . "]";
    Pft_Log::addLog('Cache exception : ' . $errorInfo);
Esempio n. 12
0
 /**
  * 根据controllerName 和 actionName 生产一个 controller
  *
  * @param String $controllerName
  * @param String $actionName
  * @return Pft_Controller_Action
  */
 public static final function factory($controllerName, $actionName)
 {
     //$toFile = Pft_Config::getAppPath() . $controllerName . ".php";
     $toFile = Pft_Config::getAbsPathFilename("PATH_APP", $controllerName . ".php");
     //$arrTmp = array_map("ucfirst", explode( DIRECTORY_SEPARATOR, $controllerName) );
     $arrTmp = array_map("ucfirstForControl", explode(DIRECTORY_SEPARATOR, $controllerName));
     $className = ucfirst(implode("", $arrTmp)) . "Controller";
     /**
      * 去掉了 Ctrl
      * @author y31
      * Mon Dec 10 23:19:08 CST 2007
      */
     /*
     这里要适应变化
     通过上面的代码改成一个controller多个action的形式
     
     		//这种形式要求 conntroller
     		$toFile = PATH_APP . $controllerName . DIRECTORY_SEPARATOR . $actionName . ".php";
     		
     		$arrTmp = array_map("ucfirst", explode( DIRECTORY_SEPARATOR, $controllerName) );
     		$className = ucfirst(implode("",$arrTmp)).ucfirst($actionName)."Controller";
     */
     if (DEBUG) {
         include_once $toFile;
     } else {
         @(include_once $toFile);
     }
     //Pft::loadFile( $toFile );
     if (class_exists($className)) {
         $class = new $className();
         $class->setScriptFile($toFile);
         $class->setControllerName(str_replace(DIRECTORY_SEPARATOR, "_", str_replace("/ctrl/", "/", $controllerName)));
         $class->setControllerPrivilegeMaps();
         return $class;
     } else {
         throw new Exception(Pft_I18n::trans("ERR_APP_LOST_CONTROLLER") . "[ " . $className . " ]");
         return null;
     }
 }
Esempio n. 13
0
 private function _checkAndMakeViewFolder($arrPackage, $ctrlName)
 {
     //创建
     //$toCheckViewPath = Pft_Config::getViewPath();
     $toCheckViewPath = Pft_Config::getAppPath();
     foreach ($arrPackage as $subFolder) {
         if ($subFolder == 'ctrl') {
             $subFolder = "view";
         }
         $toCheckViewPath .= $subFolder . "/";
         $this->_mkdir($toCheckViewPath);
     }
     $toCheckViewPath .= strtolower($ctrlName) . "/";
     $this->_mkdir($toCheckViewPath);
     return $toCheckViewPath;
 }
Esempio n. 14
0
 /**
  * 设置次要config
  *
  * @param array $config
  */
 public static function setSecondaryConfig($config)
 {
     self::$_secCfg = $config;
 }
Esempio n. 15
0
 function __construct()
 {
     $this->_selector_lib_path = Pft_Config::getSiteRoot() . 'js/tpm/';
 }
Esempio n. 16
0
 /**
  * 记录操作数据库日志
  *
  * @param string $sql
  */
 public static function logDbOprate($sql)
 {
     $sql = trim($sql);
     if (!$sql) {
         return false;
     }
     //生成消息序列 by jute
     $enableSync = Pft_Config::getCfgInFile('EnableSync', 'sync/sync.conf.php');
     if ($enableSync == '1') {
         Pft_Sync_MessageListManage::createDbMsgList($sql);
     }
     $tableName = '';
     $logName = '';
     $msg = '';
     //忽略列表优先于允许列表
     $ignoreTalbenameList = array('tpm_rizhi' => 'rz_id', 'tpm_xiangmu_rizhi' => 'rz_id', 'tpm_ziyuan_rizhi' => 'rz_id', 'tpm_rizhi_fangwen' => 'rz_id');
     $toLogTablenameList = array('tpm_dingdan' => 'dd_id', 'tpm_shengchandingdan' => 'sd_id', 'tpm_xiangmu' => 'xm_id', 'tpm_renwu' => 'rw_id', 'tpm_gaojian' => 'gj_id', 'tpm_yonghukuozhan' => 'yh_id', 'tpm_yonghu' => 'yh_id', 'tpm_kehu_yonghu' => 'yh_id');
     //因为之前已经trim了,所以 === 0
     if (stripos($sql, 'SELECT') === 0) {
         //不记录Select
         return false;
         //$sql = str_replace( array("\n","\r") , array(" ", "" ) , $sql );
     } elseif (stripos($sql, 'UPDATE') === 0) {
         /*
         			/update[\s]+(\w+)[\s]+set(.*)where[\s]+(.*)/
                      ^^table name ^^col         ^^cond
         */
         if (preg_match("/update[\\s]+(\\w+)[\\s]+set(.*)where[\\s]+(.*)/i", $sql, $matchs)) {
             $tableName = $matchs[1];
             $cols = $matchs[2];
             $cond = $matchs[3];
             $logName = self::DB_OPRATE_TYPE_PREFIX . '-' . $tableName . '-' . self::DB_OPRATE_TYPE_UPDATE;
             $msg = $cols . self::DB_OPRATE_MSG_SPLITER . $cond;
         }
     } elseif (stripos($sql, 'INSERT') === 0) {
         /*
         /insert into[\s]+(\w+)[\s]+\((.*)\)[\s]+values[\s]+\((.*)\)/
         */
         if (preg_match('/insert into[\\s]+(\\w+)[\\s]+\\((.*)\\)[\\s]+values[\\s]+\\((.*)\\)/i', $sql, $matchs)) {
             $tableName = $matchs[1];
             $cols = $matchs[2];
             $values = $matchs[3];
             $logName = self::DB_OPRATE_TYPE_PREFIX . '-' . $tableName . '-' . self::DB_OPRATE_TYPE_INSERT;
             $msg = $cols . self::DB_OPRATE_MSG_SPLITER . $values;
         }
     } elseif (stripos($sql, 'DELETE') === 0) {
         /*
         /insert into[\s]+(\w+)[\s]+\((.*)\)[\s]+values[\s]+\((.*)\)/
         */
         if (preg_match('/DELETE FROM[\\s]+(\\w+)[\\s]+WHERE(.*)/i', $sql, $matchs)) {
             $tableName = $matchs[1];
             $cond = $matchs[2];
             $logName = self::DB_OPRATE_TYPE_PREFIX . '-' . $tableName . '-' . self::DB_OPRATE_TYPE_DELETE;
             $msg = $cond;
         }
     } else {
         /**
          * 对未解析的SQL 也记录在案
          * @author terry
          * @version 0.1.0
          * Wed Sep 26 13:38:08 CST 2007
          */
         $logName = self::DB_OPRATE_TYPE_UNKNOWN;
         $msg = $sql;
     }
     //strtolower( $tableName ) != 'tpm_rizhi'
     if ($msg && $logName && !key_exists(strtolower($tableName), $ignoreTalbenameList) && key_exists(strtolower($tableName), $toLogTablenameList) && !(stripos($sql, 'UPDATE tpm_yonghu SET YH_ZAIXIAN_ZHUANGTAI') === 0)) {
         /**
          * 更新用户状态的不记录在数据库
          * @author terry
          * @version 0.1.0
          * Sat Sep 29 19:41:27 CST 2007
          */
         //			print"<pre>Terry :";var_dump( $logName );print"</pre>";
         //			print"<pre>Terry :";print ( $msg );print"</pre>";
         //			exit();
         self::addLog("Execute [ {$sql} ]" . self::DB_OPRATE_MSG_SPLITER . $msg, self::LEVEL_SYSTEM, $logName);
         return true;
     } else {
         /**
          * 忽略列表中的数据表操作亦将不被写入文件Log
          * @author terry
          * @version 0.1.0
          * Wed Sep 05 09:46:56 CST 2007
          */
         if (!key_exists(strtolower($tableName), $ignoreTalbenameList)) {
             self::addLog("Execute [ {$sql} ]", Pft_Log::LEVEL_DEBUG, $logName);
         }
         return false;
     }
 }
Esempio n. 17
0
 function __construct()
 {
     $this->_menu_lib_path = Pft_Config::getSiteRoot(1) . 'js/jsmenu/';
 }
Esempio n. 18
0
 /**
  * john 添加
  * 生成文件再下载的方法(改变路径)
  * 2007-4-10
  *
  * @param unknown_type $array
  * @param unknown_type $csv_name
  */
 public static function ExportToCsvPath($array, $csv_name = false, $path = false)
 {
     if ($path) {
         $rootpath = $path;
     } else {
         $rootpath = Pft_Config::getUploadPath();
     }
     $str = "";
     if (!$csv_name) {
         $csv_name = 'dingdanbaobiao' . date('-ymd-Hi', time());
     } else {
         $csv_name = $csv_name . date('-ymd-Hi', time());
     }
     if (is_array($array)) {
         $jc = current($array);
         if (is_array($jc)) {
             foreach ($array as $key => $value) {
                 $str .= self::_outcsv($value) . "\r\n";
             }
         } else {
             $str = self::_outcsv($array) . "\r\n";
         }
     }
     $file = $rootpath . $csv_name . ".csv";
     $handle = fopen($file, 'w+');
     fputs($handle, $str);
     fclose($handle);
     //$path=$rootpath.$csv_name.".csv";
     $path = Pft_Config::getSiteRoot() . "upload/res/error/" . $csv_name . ".csv";
     return $path;
     /*if($str!="")
     		{
     			
     		$file1 = fopen($file,"rb"); // 打开文件 
       
     		// 输入文件标签
     		//ob_clean();		
     		header("Content-Type:application/octet-stream");
     		//header('Content-type: application/csv');
     		header("Accept-Ranges:bytes");
     		
     		header("Accept-Length:".filesize($file));
     		
     		header('Content-Disposition:attachment;filename='.$csv_name.'.csv');
     		//header('Content-Description: PHP3 Generated Data');
     
     		// 输出文件内容
     		
     		echo  fread($file1,filesize($file));
     		
     		fclose($file1);
     		
     		exit;
     		}*/
 }
Esempio n. 19
0
 * 显示 products 列表的界面
 * 
 * 输入:
 * $productss
 * 
 * @author 
 */
?>
<div class="toolbar">
<a href="?do=adm_ec_product_add" class="btn add"><?php 
echo Pft_I18n::trans("PRODUCTS_ADD");
?>
</a>
</div>
<?php 
//$productss_grid = new Pft_Util_Grid( $productss );
$productss_grid->addCol(" ", "p_id", true, '"<input type=checkbox value=\\"".$row["p_id"]."\\">"');
$productss_grid->addCol(Pft_I18n::trans("p_id"), "p_id");
$productss_grid->addCol(Pft_I18n::trans("k_id"), "k_id");
$productss_grid->addCol(Pft_I18n::trans("p_name"), "p_name");
$productss_grid->addCol(Pft_I18n::trans("p_price"), "p_price");
$productss_grid->addCol(Pft_I18n::trans("p_info"), "p_info");
$productss_grid->addCol(Pft_I18n::trans("p_img_link"), "p_img_link");
$productss_grid->addCol(Pft_I18n::trans("p_unit"), "p_unit");
$productss_grid->addCol(Pft_I18n::trans("created_at"), "created_at");
$productss_grid->addCol(Pft_I18n::trans("updated_at"), "updated_at");
$productss_grid->addCol(Pft_I18n::trans("is_del"), "is_del");
$productss_grid->addCol(Pft_I18n::trans("Opration"), "", true, '"<a href=\\"?do=adm_ec_product_edit&p_id=".$row["p_id"]."\\" class=\\"btn\\">".Pft_I18n::trans("EDIT")."</a> <a href=\\"?do=adm_ec_product_delete&p_id=".$row["p_id"]."\\" class=\\"btn\\" onclick=\\"return confirm(\'".Pft_I18n::trans("CONFIRM_OPRATION")."\')\\">".Pft_I18n::trans("DELETE")."</a>"');
$productss_grid->showMe();
include Pft_Config::getRootPath() . "inc/view/footer.inc.php";
Esempio n. 20
0
    /**
     * 职责变了,这个方法没有用了
     *
     * @param boolean $show
     * @return string
     */
    public function render($show = true)
    {
        /**
         * 是否输出主体
         */
        $outputBody = true;
        ob_start();
        //echo "Html Header";
        //echo "Body Header";
        if ($this->_header && is_array($this->_header)) {
            //这里展开了 sys_title 和 tpm_css
            extract($this->_header);
        }
        include $this->_getAbsViewPathFilename("inc/header.dailog.html.php");
        /**
         * 基础js函数
         */
        ?>
<!--日历选择时间时调用服务器时间 jute 20071122-->
<script src="<?php 
        echo Pft_Config::getHttpHost();
        ?>
js/calendar/tpmsystemdate.php"></script>
<script src="<?php 
        echo Pft_Config::getHttpHost();
        ?>
js/common.js"></script>
<script src="<?php 
        echo Pft_Config::getHttpHost();
        ?>
js/john/ajax.js"></script>
<script src="<?php 
        echo Pft_Config::getHttpHost();
        ?>
js/prototype_1_5_0.js"></script>
<!--ext-->
<!--link rel="stylesheet" type="text/css" href="<?php 
        echo Pft_Config::getHttpHost();
        ?>
js/ext-1.0/resources/css/ext-all.css" /-->
<!-- GC -->
<?php 
        if (@$_REQUEST['ext-all']) {
            ?>
<!-- LIBS -->
<script type="text/javascript" src="<?php 
            echo Pft_Config::getHttpHost();
            ?>
js/ext-1.0/adapter/yui/yui-utilities.js"></script>
<script type="text/javascript" src="<?php 
            echo Pft_Config::getHttpHost();
            ?>
js/ext-1.0/adapter/yui/ext-yui-adapter.js"></script>
<!-- ENDLIBS -->
<script type="text/javascript" src="<?php 
            echo Pft_Config::getHttpHost();
            ?>
js/ext-1.0/ext-all.js"></script>
<?php 
        } else {
            ?>
<!--Used in Tpm-->
<!--script type="text/javascript" src="<?php 
            echo Pft_Config::getHttpHost();
            ?>
js/ext.js"></script-->
<?php 
        }
        ?>
<!--END Ext-->

<script src="<?php 
        echo Pft_Config::getHttpHost();
        ?>
js/john/jsdialog/dialog.js"></script>
<link rel='stylesheet' href='./js/john/jsdialog/dialog.css'>
<script src="<?php 
        echo Pft_Config::getHttpHost();
        ?>
js/john/sendMsg.js"></script>
<div id="popup_div_msg" style="position:absolute;display:none">
</div>
<?php 
        /**
         * 在top显示loading
         */
        //		echo "<script>if(top.controlProgressBar)top.controlProgressBar();</script>";
        /**
         * 这里显示 Tq消息
         * Tq消息要在 tip 之前
         */
        echo Tpm_Message_Sender_Tq::getMsgHtml();
        /**
         * 处理在 ctrl 里设置的tip提示信息
         */
        if (key_exists(Pft_Controller_Action::HEADER_TIP, $this->_header)) {
            $tip = $this->_header[Pft_Controller_Action::HEADER_TIP];
            echo "<script>";
            if ($nextUrl = $tip[Pft_Controller_Action::HEADER_TIP_URL]) {
                $matchs = null;
                if (preg_match("/^javascript:(.*)/", $nextUrl, $matchs)) {
                    //						echo "function onloadTip(){Ext.Msg.alert('TPM', '".addslashes($tip[Pft_Controller_Action::HEADER_TIP_MSG])."', function(){{$matchs[1]};return false;});}";
                    echo "function onloadTip() {top.alert('" . addslashes($tip[Pft_Controller_Action::HEADER_TIP_MSG]) . "');{$matchs[1]}}";
                } else {
                    //						echo "function onloadTip(){Ext.Msg.alert('TPM', '".addslashes($tip[Pft_Controller_Action::HEADER_TIP_MSG])."', function(){location.href='".$nextUrl."';return false;});}";
                    echo "function onloadTip() {top.alert('" . addslashes($tip[Pft_Controller_Action::HEADER_TIP_MSG]) . "');location.href='" . $nextUrl . "'}";
                }
                //如果有转向,则不输出主体
                $outputBody = false;
            } else {
                //				echo "function onloadTip(){top.Ext.Msg.alert('TPM', '".addslashes($tip[Pft_Controller_Action::HEADER_TIP_MSG])."');}";
                echo "function onloadTip(){top.alert('" . addslashes($tip[Pft_Controller_Action::HEADER_TIP_MSG]) . "');}";
            }
            echo "window.onload = onloadTip;";
            //echo "Ext.onready( onloadTip );";
            echo "</script>";
        }
        if ($outputBody) {
            //没有设置不显示主体
            //这里显示菜单 有true 是因为 菜单数据目前是在Pft_View_Helper_Menu里的
            //			if( isset( $this->_header["menu"] ) )
            //			{
            //				//var_dump( $this->_header );
            //				$menu = new Pft_View_Helper_Menu();
            //				$menu->buildMenu( $this->_header["menu"] );
            //				//$menu->buildMenu( null );
            //			}
            /**
             * 这里显示主体部分
             */
            parent::render(true);
        }
        /**
         * 结束loading
         */
        //		echo "<script>if(top.Element)top.Element.hide('floatProgress_backgroup')//top.controlProgressBar('1');</script>";
        //		echo "<script>if(top.Element)top.Element.hide('floatProgress')//top.controlProgressBar('1');</script>";
        /**
         * 这里显示底部
         */
        //echo "Body Footer";
        //include( $this->_getAbsViewPathFilename( "inc/footer.dailog.html.php" ) );
        $out = ob_get_clean();
        if ($show) {
            echo $out;
        }
        return $out;
    }
Esempio n. 21
0
 /**
  * 
  * @param $tbname
  * @return string
  * @author yan
  * @date 2010-10-3下午06:25:08
  */
 public static function getTbName($tbname)
 {
     return Pft_Config::getCfg('DB_TB_PREFIX') . $tbname;
 }
Esempio n. 22
0
 /**
  * 获取当前Session的组ID
  *
  */
 public function getGroupId()
 {
     $rev = $this->_groupId;
     if (!$rev) {
         $rev = r('zu_id');
         //如果当前会话没有组ID,使用 URL 指定的组ID
         if (!$rev) {
             $rev = Pft_Config::getDefaultZuId();
             //如果 URL 也没有组ID,使用默认组ID
         }
         $this->_groupId = $rev;
         //将当前会话用户归入之前选定的组
     }
     return $rev;
 }
Esempio n. 23
0
 /**
  * 处理 do
  * 有可能会返回 goToDo
  * 
  * 只有一个单词的do,对应的action是 index
  * 
  *
  * @param string $do
  * @return string $goToDo
  */
 protected function processDo($do, $defaultView = "Html")
 {
     if ($do == "") {
         $e = new Pft_Exception(Pft_I18n::trans("ERR_DISPATCH_NODO"));
         throw $e;
     }
     $goToDo = "";
     $arrCtrlAndAction = $this->_analyzeDoToControllerAndAction($do);
     $controller = $arrCtrlAndAction[0];
     $action = $arrCtrlAndAction[1];
     $doFile = $arrCtrlAndAction[2];
     $doAction = $arrCtrlAndAction[3];
     //使用 ob_start 是为了Controller里的 redirect 可以正常使用
     //ob_start();
     $theCtrl = Pft_Controller_Action::factory($controller, $action);
     /**
      * 检查 会话的权限。 
      * 如果没有权限,抛出一个异常
      * 此处别扭
      */
     $rbac = new Pft_Rbac();
     //$rbac->checkSession(Pft_Session::getSession(), $do);
     $privilege = $rbac->checkActionPrivilege(Pft_Session::getSession(), $theCtrl, $action);
     if ($privilege instanceof TpmYonghuzhaoquanxian) {
         if (!$theCtrl->getTitle()) {
             $theCtrl->setTitle(Pft_I18n::trans($privilege->getQxMingcheng()));
         }
     }
     Pft_Debug::addInfoToDefault('', 'Pre do action.');
     if (method_exists($theCtrl, $doAction)) {
         //执行controller中的action
         $theCtrl->{$doAction}();
     } else {
         throw new Exception(Pft_I18n::trans("ERR_APP_LOST_ACTION"));
     }
     Pft_Debug::addInfoToDefault('', 'After do action..');
     $goToDo = $theCtrl->getGoToDo();
     $data = $theCtrl->getData();
     if (defined("DEBUG") && DEBUG) {
         //调试阶段才显示Controller里输出的信息
         //echo ob_get_clean();
     } else {
         //用户使用阶段不允许 action 里输出显示数据
         //ob_clean();
     }
     if ($theCtrl->isNeedView()) {
         Pft_Debug::addInfoToDefault('', 'Pre load view..');
         if ($theCtrl->getViewType()) {
             $defaultView = $theCtrl->getViewType();
         }
         $view = Pft_View::factory($defaultView, Pft_Config::getViewPath());
         $view->setHeader($theCtrl->getHeader());
         Pft_Debug::addInfoToDefault('', 'After view factory..');
         /**
          * 如果用户已登录,读取菜单信息
          * @todo 未登录可能也可以有菜单
          */
         if ($user_id = Pft_Session::getSession()->getUserId()) {
             $tpmCaidans = TpmCaidanPeer::getJueseCaidan(Pft_Session::getSession()->getRoleId());
             if (count($tpmCaidans)) {
                 $view->setHeader($tpmCaidans, "menu");
                 //					$menus = array();
                 //					foreach ( $tpmCaidans as $tpmCaidan )
                 //					{
                 //						$menus[] = array( $tpmCaidan->getCdMingcheng()
                 //						                , $tpmCaidan->getCdChuliye()
                 //						);
                 //					}
                 //					$view->setHeader( $menus, "menu" );
             }
         }
         //读取菜单完
         //$view->renderModel($theCtrl);
         $view->renderView($data, $this->_getDefaultViewFileOfAction($controller, $action), true);
     }
     return $goToDo;
 }
Esempio n. 24
0
		<a href="?do=kw_content_mark&ct_id=<?php 
        echo $content['ct_id'];
        ?>
&mk=3">精品</a>
		<a href="?do=kw_content_mark&ct_id=<?php 
        echo $content['ct_id'];
        ?>
&mk=1">有用</a>
		<a href="?do=kw_content_mark&ct_id=<?php 
        echo $content['ct_id'];
        ?>
&mk=-1">没用</a>
		<a href="?do=kw_content_mark&ct_id=<?php 
        echo $content['ct_id'];
        ?>
&mk=-3">垃圾</a>
	</div>
	</div>
		<?php 
    }
} else {
    ?>
	<div class="content">暂时没有内容。</div>
	<?php 
}
?>
</div>
<?php 
include dirname(__FILE__) . '/../content/addForm.inc.php';
include Pft_Config::getCfg('PATH_INC') . 'view/footer.inc.php';
Esempio n. 25
0
 /**
  * 预载入propel 及 相关的类
  */
 public static function preLoadPropelClasses()
 {
     //单系统路径模式
     //self::loadFile( "PropelException.php", Pft_Config::getLibPath()."propel", true );
     //多系统路径模式
     $pathfilename = Pft_Config::getAbsPathFilename("PATH_LIB", "propel/PropelException.php");
     self::loadFile($pathfilename, null, true);
     //单系统路径模式
     //self::loadFile( "Propel.php", Pft_Config::getLibPath()."propel", true );
     //多系统路径模式
     $pathfilename = Pft_Config::getAbsPathFilename("PATH_LIB", "propel/Propel.php");
     self::loadFile($pathfilename, null, true);
     Propel::init(Pft_Config::getPropelConfFilename());
     //单系统路径模式
     //self::loadFile( "Criteria.php", Pft_Config::getLibPath()."propel/util", true );
     //多系统路径模式
     $pathfilename = Pft_Config::getAbsPathFilename("PATH_LIB", "propel/util/Criteria.php");
     self::loadFile($pathfilename, null, true);
     /**
      * 在 XxxxPeer 中自动 load Propel时,
      * 在此处 throw 的 exception 不能在 index 中捕获,
      * 怀疑在 Propel 的 某些Class 中 catch 了异常,然后没有再抛出
      */
     //throw new Exception("in preLoadPropelClasses");
 }
Esempio n. 26
0
 /**
  * 获得 view 的文件名
  * 输入的参数是相对于 view 根目录的 PathFilename
  * 自动获得绝对ViewPathFilename
  * 
  * 单独写一个方法是为了对付外部设置view路径的时的情况。
  * 那时就在这里修改就好了。
  *
  * @param string $relFilename
  * @return string
  */
 protected function _getAbsViewPathFilename($relPathFilename)
 {
     //return Pft_Config::getAbsPathFilename( "PATH_VIEW", $relPathFilename );
     /**
      * 改为在子系统下放置view的模式
      * @author y31
      * Mon Dec 10 23:32:01 CST 2007
      */
     return Pft_Config::getAbsPathFilename("PATH_APP", str_replace("/ctrl", "/view", str_replace("\\", "/", $relPathFilename)));
 }
Esempio n. 27
0
        <div id="productRight">
          <div>
          <table width="100%" cellpadding="0" cellspacing="0" border="0" id="buyTable">
          
          <tr>
           <td width="30%"><b>菜品</td>
           <td width="15%"><b>单价</td>
           <td width="20%"><b>数量</td>
           <td width="20%"><b>小计</td>
           <td width="15%"><b>操作</td>
          </tr>
          <tr>
           
          </tr>
          </table>
          </div>
          <div id="pZongji">
          合计:<span id="zTotal"></span>
          <input type="hidden" id="Total" name="Total">
          </div>
       </div>
     </div>
    </td>
  </tr>
</table>
</div>
</center>
</body>
<?php 
include Pft_Config::getCfg('PATH_ROOT') . 'inc/view/footer.inc.php';
Esempio n. 28
0
 /**
  * 初始化
  */
 private static function _init()
 {
     if (!self::$_site_code) {
         self::$_site_code = sprintf("%02d", Pft_Config::getEpollGroupId());
     }
 }
Esempio n. 29
0
        //var_export( $cfg_sec );
        $arr_path_model[] = $cfg_sec["PATH_MODEL"];
        $arr_path_model = array_unique($arr_path_model);
        $arr_path_lib[] = $cfg_sec["PATH_LIB"];
        $arr_path_lib = array_unique($arr_path_lib);
    }
    //set_include_path(implode(INC_SPLIT,$arr_path_model).INC_SPLIT.implode(INC_SPLIT,$arr_path_lib).INC_SPLIT.get_include_path());
    //set_include_path( $cfg["PATH_LIB"].INC_SPLIT.PATH_LIB."model/" );
} else {
    set_include_path($cfg_pri["PATH_LIB"] . INC_SPLIT . get_include_path());
    //set_include_path($cfg_pri["PATH_LIB"].INC_SPLIT.$cfg_pri["PATH_MODEL"].INC_SPLIT.get_include_path());
    //to reduce system load
}
//echo get_include_path();
/**
 * 基本的环境管理和类管理 需PHP5
 */
require_once $cfg_pri["PATH_LIB"] . 'Pft.php';
//========================================
/**
* 实现在创建对象时,自动加载类定义,即不用include Class文件 Only PHP5
*/
function __autoload($class)
{
    Pft::loadClass($class);
    /*Pft::loadclass2($class);*/
}
Pft_Config::setPrimaryConfig($cfg_pri);
if (defined("MULTI_SYSPATH_MODE") && isset($cfg_sec)) {
    Pft_Config::setSecondaryConfig($cfg_sec);
}
Esempio n. 30
0
    /**
     * 说明
     *
     * 返回数据列表
     */
    private function html_data()
    {
        /*/$html_data	=	'<table border=1 width=100%>';*/
        // +--------------------------锁定表格--------------------------+
        if ($this->lock_table != 'OFF') {
            $html_data = '<SCRIPT language=JavaScript >
			var DataFields=new Array()
			';
            if (is_array($this->pure_data)) {
                $js_key = 0;
                foreach ($this->pure_data as $key => $var) {
                    $html_data .= "\n\t\t\t\t\t\tDataFields[" . $js_key . "] =new Array(";
                    foreach ($var as $key => $value) {
                        //$value	=	htmlspecialchars($value);
                        $value = addslashes($value);
                        $value = str_replace("\n", "\\", $value);
                        $html_data .= "\"" . $value . "\",";
                    }
                    $html_data = rtrim($html_data, ",");
                    $html_data .= ")\n\t\t\t\t\t\t\t\t   ";
                    $js_key++;
                }
            }
            $html_data .= '</SCRIPT>';
            $html_data .= $this->lock_js();
            $html_data .= '<TR>
			<TD  colspan=50><TABLE cellSpacing=0 cellPadding=0 border=0>
  <TBODY>
  <TR>
    <TD ><DIV id=TonyDataTable></DIV></TD></TR></TBODY></TABLE></TD></TR>';
            return $html_data;
        }
        // +--------------------------end锁定表格--------------------------+
        // +-------------------------------js-鼠标单击的颜色------------------------------------+
        $html_data .= '<script>
		function R_changeBG(RocID)
		{
			if(document.all)
			{
				var Roc = document.getElementById(RocID)
				var BackGround = Roc.style.background.toUpperCase();
				if (BackGround.match("#FFFADF"))
				{
					Roc.style.background = "#EEF0F6";
				}
				else
				{
					Roc.style.background = "#FFFADF";
				}
			}
		}
						</script>';
        // +-------------------+
        if (is_array($this->pure_data)) {
            foreach ($this->pure_data as $keyz => $var) {
                $html_data .= "<tr  id=\"Roc" . $i . "\" " . $this->html_style[data] . "  onclick=\"R_changeBG('Roc" . $i . "');\" onMouseOver=\"this.className ='bg';\" onMouseOut=\"this.className='source'\">";
                //修改成样式了 Victor 20070613
                foreach ($var as $key => $value) {
                    $html_data .= "<td>" . $value . "</td>";
                }
                $html_data .= "</tr>";
                $i++;
            }
            //小计
            if ($this->xs_xiaoji) {
                $html_data .= "<tr  id=\"Roc" . $i . "\" " . $this->html_style[data] . "  onclick=\"R_changeBG('Roc" . $i . "');\" onMouseOver=\"this.style.backgroundColor ='#FFFFFF';\" onMouseOut=\"this.style.backgroundColor ='#EEF0F6';\">";
                $j = 0;
                foreach ($this->m_tot_arr as $key => $value) {
                    if ($j) {
                        if ($this->format) {
                            if (is_float($value)) {
                                $html_data .= "<td><b>" . ($value ? Pft_Config::sechof($value) : '') . "</b></td>";
                            } else {
                                $html_data .= "<td><b>" . ($value ? $value : '') . "</b></td>";
                            }
                        } else {
                            $html_data .= "<td><b>" . ($value ? $value : '') . "</b></td>";
                        }
                    } else {
                        $html_data .= "<td><b>" . $this->z_language['小计'] . "</b></td>";
                    }
                    $j++;
                }
                $html_data .= "</tr>";
            }
            //合计
            if ($this->xs_heji) {
                $html_data .= "<tr  id=\"Roc" . $i . "\" " . $this->html_style[data] . "  onclick=\"R_changeBG('Roc" . $i . "');\" onMouseOver=\"this.style.backgroundColor ='#FFFFFF';\" onMouseOut=\"this.style.backgroundColor ='#EEF0F6';\">";
                $j = 0;
                foreach ($this->tot_arr as $key => $value) {
                    if ($j) {
                        if ($this->format) {
                            if (is_float($value)) {
                                $html_data .= "<td><b>" . ($value ? Pft_Config::sechof($value) : '') . "</b></td>";
                            } else {
                                $html_data .= "<td><b>" . ($value ? $value : '') . "</b></td>";
                            }
                        } else {
                            $html_data .= "<td><b>" . ($value ? $value : '') . "</b></td>";
                        }
                    } else {
                        $html_data .= "<td><b>" . $this->z_language['合计'] . "</b></td>";
                    }
                    $j++;
                }
                $html_data .= "</tr>";
            }
        }
        //$html_data	.=	'</table>';
        return $html_data;
    }