• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP CApp类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中CApp的典型用法代码示例。如果您正苦于以下问题:PHP CApp类的具体用法?PHP CApp怎么用?PHP CApp使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了CApp类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: __callStatic

 /**
  * Магический метод получения любых классов
  *
  * @param $name
  * @param array $params
  * @throws Exception
  */
 public static function __callStatic($name, $params = array())
 {
     /**
      * Получаем имя класса из имени функции
      */
     $className = "C" . CUtils::strRight($name, "get");
     if (!class_exists($className)) {
         throw new Exception("В приложении не объявлен класс " . $className);
     }
     /**
      * @var CActiveModel $simpleClass
      */
     $simpleClass = new $className();
     $table = $simpleClass->getRecord()->getTable();
     $id = $params[0];
     /**
      * Попробуем сначала получить из кэша
      */
     $keySeek = $table . "_" . $id;
     if (CApp::getApp()->cache->hasCache($keySeek)) {
         return CApp::getApp()->cache->get($keySeek);
     }
     $ar = CActiveRecordProvider::getById($table, $id);
     if (!is_null($ar)) {
         $obj = new $className($ar);
         CApp::getApp()->cache->set($keySeek, $obj, 60);
         return $obj;
     }
 }
开发者ID:Rustam44,项目名称:ASUPortalPHP,代码行数:36,代码来源:CBaseManager.class.php


示例2: linkCss

 public static function linkCss($link)
 {
     if (strstr($link, 'css/') == 0) {
         $link = CApp::settings("APPLICATION")->template_path . $link;
     }
     return '<link href="' . $link . '" type="text/css" rel="stylesheet">';
 }
开发者ID:ennjamusic,项目名称:study,代码行数:7,代码来源:CAssets.php


示例3: run

 public function run()
 {
     $this->ts = time();
     $this->plat = CApp::app()->tty()->getParam('plat', 1);
     $this->action = CApp::app()->tty()->getParam('action', 'exchange');
     $this->auto = CApp::app()->tty()->getParam('auto');
     $this->begin_ts = strtotime(CApp::app()->tty()->getParam('begin', date('Y-m-d H:i:s', $this->ts - $this->timeSlice)));
     $this->end_ts = strtotime(CApp::app()->tty()->getParam('end', date('Y-m-d H:i:s', $this->ts)));
     //自动补数据(补单)
     if ($this->auto) {
         $this->begin_ts = strtotime(date('Ymd', strtotime("-1 day")) . ' 00:00:00');
         $this->end_ts = strtotime(date('Ymd', strtotime("-1 day")) . ' 23:59:59');
     }
     //不能跨月   否则取当天时间
     if (date('Ym', $this->begin_ts) != date('Ym', $this->end_ts)) {
         $this->end_ts = strtotime(date('Ymd', $this->begin_ts) . ' 23:59:59');
         $this->flag = false;
     }
     /*
     if ($this->action == 'union_exchange')
     {
     	$this->op_id = CApp::app()->tty()->getParam('op_id');
     }
     */
     if (!array_key_exists($this->plat, $this->curl)) {
         die('Error plat!');
     }
     $this->handleData();
 }
开发者ID:wlmwang,项目名称:simple-php-frame,代码行数:29,代码来源:ExchangeLogController.php


示例4: __construct

 public function __construct()
 {
     $_dbConf = CApp::app()->getConf('Db');
     foreach ($_dbConf as $identify => $conf) {
         $this->_Db[$identify] = CDb::createDb($conf['host'], $conf['user'], $conf['pwd'], $conf['dbName']);
     }
 }
开发者ID:wlmwang,项目名称:simple-php-frame,代码行数:7,代码来源:CDaoModel.php


示例5: createApplication

 /**
  * Синглтон приложения
  *
  * @static
  * @param array $config
  * @return CApp
  */
 public static function createApplication(array $config)
 {
     if (is_null(self::$_inst)) {
         self::$_inst = new CApp($config);
     }
     return self::$_inst;
 }
开发者ID:Rustam44,项目名称:ASUPortalPHP,代码行数:14,代码来源:CApp.class.php


示例6: connect

 /**
  * Connect to a AS400 DB2 SQL server via ODBC driver
  * 
  * @throws Error on misconfigured or anavailable server
  * 
  * @return void
  */
 static function connect()
 {
     if (self::$dbh) {
         return;
     }
     $config = CAppUI::conf("sante400");
     if (null == ($dsn = $config["dsn"])) {
         trigger_error("Data Source Name not defined, please configure module", E_USER_ERROR);
         CApp::rip();
     }
     // Fake data source for chrono purposes
     CSQLDataSource::$dataSources[$dsn] = new CMySQLDataSource();
     $ds =& CSQLDataSource::$dataSources[$dsn];
     $ds->dsn = $dsn;
     self::$chrono =& CSQLDataSource::$dataSources[$dsn]->chrono;
     self::$chrono->start();
     $prefix = $config["prefix"];
     try {
         self::$dbh = new PDO("{$prefix}:{$dsn}", $config["user"], $config["pass"]);
         self::$dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
     } catch (PDOException $e) {
         mbTrace("cauguht failure on first datasource");
         if (null == ($dsn = $config["other_dsn"])) {
             throw $e;
         }
         self::$dbh = new PDO("{$prefix}:{$dsn}", $config["user"], $config["pass"]);
         self::$dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
     }
     self::$chrono->stop("connection");
     self::traceChrono("connection");
 }
开发者ID:OpenXtrem,项目名称:mediboard-test,代码行数:38,代码来源:CRecordSante400.class.php


示例7: swapPratIds

 /**
  * Change prat usernames to prat ids
  *
  * @return bool
  */
 protected function swapPratIds()
 {
     $ds = CSQLDataSource::get("std");
     CApp::setTimeLimit(1800);
     $user = new CUser();
     // Changement des chirurgiens
     $query = "SELECT id_chir\r\n        FROM plagesop\r\n        GROUP BY id_chir";
     $listPlages = $ds->loadList($query);
     foreach ($listPlages as $plage) {
         $where["user_username"] = "= '" . $plage["id_chir"] . "'";
         $user->loadObject($where);
         if ($user->user_id) {
             $query = "UPDATE plagesop\r\n            SET chir_id = '{$user->user_id}'\r\n            WHERE id_chir = '{$user->user_username}'";
             $ds->exec($query);
             $ds->error();
         }
     }
     //Changement des anesthésistes
     $query = "SELECT id_anesth\r\n         FROM plagesop\r\n         GROUP BY id_anesth";
     $listPlages = $ds->loadList($query);
     foreach ($listPlages as $plage) {
         $where["user_username"] = "= '" . $plage["id_anesth"] . "'";
         $user->loadObject($where);
         if ($user->user_id) {
             $query = "UPDATE plagesop\r\n            SET anesth_id = '{$user->user_id}'\r\n            WHERE id_anesth = '{$user->user_username}'";
             $ds->exec($query);
             $ds->error();
         }
     }
     return true;
 }
开发者ID:fbone,项目名称:mediboard4,代码行数:36,代码来源:setup.php


示例8: getSetting

 /**
  * Получить настройку по псевдониму или ключевому полю
  *
  * @param $key
  * @return CSetting
  */
 public static function getSetting($key)
 {
     if (is_string($key)) {
         $key = strtoupper($key);
     }
     $cacheKey = CACHE_APPLICATION_SETTINGS . '_' . $key;
     if (!CApp::getApp()->cache->hasCache($cacheKey)) {
         $found = false;
         if (is_string($key)) {
             foreach (CActiveRecordProvider::getWithCondition(TABLE_SETTINGS, "UPPER(alias) = '" . $key . "'")->getItems() as $item) {
                 $found = true;
                 $setting = new CSetting($item);
                 CApp::getApp()->cache->set(CACHE_APPLICATION_SETTINGS . '_' . $setting->getId(), $setting);
                 CApp::getApp()->cache->set($cacheKey, $setting);
             }
         } elseif (is_numeric($key)) {
             $item = CActiveRecordProvider::getById(TABLE_SETTINGS, $key);
             if (!is_null($item)) {
                 $found = true;
                 $setting = new CSetting($item);
                 CApp::getApp()->cache->set(CACHE_APPLICATION_SETTINGS . '_' . $setting->alias, $setting);
                 CApp::getApp()->cache->set($cacheKey, $setting);
             }
         }
         if (!$found) {
             CApp::getApp()->cache->set($cacheKey, null);
         }
     }
     return CApp::getApp()->cache->get($cacheKey);
 }
开发者ID:Rustam44,项目名称:ASUPortalPHP,代码行数:36,代码来源:CSettingsManager.class.php


示例9: mine

 static function mine($parent_class)
 {
     $classes = CApp::getChildClasses($parent_class);
     $limit = CAppUI::conf("dataminer_limit");
     foreach ($classes as $_class) {
         $miner = new $_class();
         $report = $miner->mineSome($limit, "mine");
         $dt = CMbDT::dateTime();
         echo "<{$dt}> Miner: {$_class}. Success mining count is '" . $report["success"] . "'\n";
         if (!$report["failure"]) {
             echo "<{$dt}> Miner: {$_class}. Failure mining counts is '" . $report["failure"] . "'\n";
         }
         $miner = new $_class();
         $report = $miner->mineSome($limit, "remine");
         $dt = CMbDT::dateTime();
         echo "<{$dt}> Reminer: {$_class}. Success remining count is '" . $report["success"] . "'\n";
         if (!$report["failure"]) {
             echo "<{$dt}> Reminer: {$_class}. Failure remining counts is '" . $report["failure"] . "'\n";
         }
         $miner = new $_class();
         $report = $miner->mineSome($limit, "postmine");
         $dt = CMbDT::dateTime();
         echo "<{$dt}> Postminer: {$_class}. Success postmining count is '" . $report["success"] . "'\n";
         if (!$report["failure"]) {
             echo "<{$dt}> Postminer: {$_class}. Failure postmining counts is '" . $report["failure"] . "'\n";
         }
     }
 }
开发者ID:fbone,项目名称:mediboard4,代码行数:28,代码来源:CDataMinerWorker.class.php


示例10: init

 /**
  * @see parent::init()
  */
 function init()
 {
     if (!CMbPath::forceDir($this->dir)) {
         trigger_error("Shared memory could not be initialized, ensure that '{$this->dir}' is writable");
         CApp::rip();
     }
     return true;
 }
开发者ID:OpenXtrem,项目名称:mediboard-test,代码行数:11,代码来源:DiskSharedMemory.class.php


示例11: update

 public function update($arrayNewTranslate, $arrayOldTranslate)
 {
     $arrDiff = array_diff($arrayNewTranslate, $arrayOldTranslate);
     $arrIntersect = array_intersect($arrayNewTranslate, $arrayOldTranslate);
     $arrResult = array_merge($arrDiff, $arrIntersect);
     CApp::setTranslateArray($arrResult);
     return $arrResult;
 }
开发者ID:ennjamusic,项目名称:study,代码行数:8,代码来源:TranslateModel.php


示例12: __construct

 /**
  * CMbSemaphore Constructor
  *
  * @param string $key semaphore identifier
  */
 function __construct($key)
 {
     $this->path = CAppUI::conf("root_dir") . "/tmp/locks";
     CMbPath::forceDir($this->path);
     $this->process = getmypid();
     $prefix = CApp::getAppIdentifier();
     $this->key = "{$prefix}-sem-{$key}";
 }
开发者ID:fbone,项目名称:mediboard4,代码行数:13,代码来源:CMbSemaphore.class.php


示例13: __construct

 /**
  * Construct
  *
  * @param string $key lock identifier
  */
 function __construct($key)
 {
     $this->path = CAppUI::conf("root_dir") . "/tmp/locks";
     $this->process = getmypid();
     $prefix = CApp::getAppIdentifier();
     $this->key = "{$prefix}-lock-{$key}";
     $this->filename = "{$this->path}/{$this->key}";
     CMbPath::forceDir(dirname($this->filename));
 }
开发者ID:fbone,项目名称:mediboard4,代码行数:14,代码来源:CMbLock.class.php


示例14: doStore

 /**
  * @see parent::doStore()
  */
 function doStore()
 {
     if (isset($_FILES['attachment'])) {
         $mail_id = CValue::post('mail_id');
         $mail = new CUserMail();
         $mail->load($mail_id);
         $files = array();
         foreach ($_FILES['attachment']['error'] as $key => $file_error) {
             if (isset($_FILES['attachment']['name'][$key])) {
                 $files[] = array('name' => $_FILES['attachment']['name'][$key], 'tmp_name' => $_FILES['attachment']['tmp_name'][$key], 'error' => $_FILES['attachment']['error'][$key], 'size' => $_FILES['attachment']['size'][$key]);
             }
         }
         foreach ($files as $_key => $_file) {
             if ($_file['error'] == UPLOAD_ERR_NO_FILE) {
                 continue;
             }
             if ($_file['error'] != 0) {
                 CAppUI::setMsg(CAppUI::tr("CFile-msg-upload-error-" . $_file["error"]), UI_MSG_ERROR);
                 continue;
             }
             $attachment = new CMailAttachments();
             $attachment->name = $_file['name'];
             $content_type = mime_content_type($_file['tmp_name']);
             $attachment->type = $attachment->getTypeInt($content_type);
             $attachment->bytes = $_file['size'];
             $attachment->mail_id = $mail_id;
             $content_type = explode('/', $content_type);
             $attachment->subtype = strtoupper($content_type[1]);
             $attachment->disposition = 'ATTACHMENT';
             $attachment->extension = substr(strrchr($attachment->name, '.'), 1);
             $attachment->part = $mail->countBackRefs('mail_attachments') + 1;
             $attachment->store();
             $file = new CFile();
             $file->setObject($attachment);
             $file->author_id = CAppUI::$user->_id;
             $file->file_name = $attachment->name;
             $file->file_date = CMbDT::dateTime();
             $file->fillFields();
             $file->updateFormFields();
             $file->doc_size = $attachment->bytes;
             $file->file_type = mime_content_type($_file['tmp_name']);
             $file->moveFile($_file, true);
             if ($msg = $file->store()) {
                 CAppUI::setMsg(CAppUI::tr('CMailAttachments-error-upload-file') . ':' . CAppUI::tr($msg), UI_MSG_ERROR);
                 CApp::rip();
             }
             $attachment->file_id = $file->_id;
             if ($msg = $attachment->store()) {
                 CAppUI::setMsg($msg, UI_MSG_ERROR);
                 CApp::rip();
             }
         }
         CAppUI::setMsg('CMailAttachments-msg-added', UI_MSG_OK);
     } else {
         parent::doStore();
     }
 }
开发者ID:fbone,项目名称:mediboard4,代码行数:60,代码来源:CMailAttachmentController.class.php


示例15: deleteAction

 public function deleteAction($id)
 {
     if ($_SESSION["userRole"] == CApp::settings("USER_ROLES")->ADMIN && $_GET["view"] == "delete" && !empty($_GET["id"])) {
         $model = new UserModel();
         $model->deleteById($id);
         CApp::redirect(CApp::getLink(array("controller" => "user", "view" => "index")));
     } else {
         CApp::redirect("/");
     }
 }
开发者ID:ennjamusic,项目名称:study,代码行数:10,代码来源:UserController.php


示例16: storeObject

/**
 * Fonction utilitaire pour la sauvegarde rapide d'un object avec génération du message
 *
 * @param CMbObject $object Objet à enregister
 *
 * @return void
 */
function storeObject($object)
{
    $title = $object->_id ? "-msg-modify" : "-msg-create";
    if ($msg = $object->store()) {
        CAppUI::setMsg($msg, UI_MSG_ERROR);
        echo CAppUI::getMsg();
        CApp::rip();
    }
    CAppUI::setMsg(CAppUI::tr(get_class($object) . $title), UI_MSG_OK);
}
开发者ID:fbone,项目名称:mediboard4,代码行数:17,代码来源:do_dossier_provisoire_aed.php


示例17: actionGetObject

 public function actionGetObject($id)
 {
     $cache_id = $this->taxonomy . "_item_" . $id;
     if (is_null(CApp::getApp()->cache->get($cache_id))) {
         $taxonomy = CTaxonomyManager::getTaxonomy($this->taxonomy);
         $term = $taxonomy->getTerm($id);
         CApp::getApp()->cache->set($cache_id, $term, 30);
     }
     return CApp::getApp()->cache->get($cache_id);
 }
开发者ID:Rustam44,项目名称:ASUPortalPHP,代码行数:10,代码来源:CSearchCatalogTaxonomy.class.php


示例18: redirect

/**
 * Redirect to the last page
 *
 * @return void
 */
function redirect()
{
    if (CValue::post("ajax")) {
        echo CAppUI::getMsg();
        CApp::rip();
    }
    $m = CValue::post("m");
    $tab = CValue::post("tab");
    CAppUI::redirect("m={$m}&tab={$tab}");
}
开发者ID:OpenXtrem,项目名称:mediboard-test,代码行数:15,代码来源:do_translate_aed.php


示例19: __construct

 public function __construct($class, $msg = NULL)
 {
     if ($msg != NULL) {
         $this->message = $msg . " в файле " . $this->file . " в строке #" . $this->line;
     }
     if (CApp::settings("APPLICATION")->settings['logs_on']) {
         $log = new CLog();
         $log->logging($class, $this->message);
     }
 }
开发者ID:ennjamusic,项目名称:study,代码行数:10,代码来源:CException.php


示例20: serializeBean

 /**
  * Сериализовать бин на диск
  *
  * @param CStatefullBean $bean
  */
 public function serializeBean(CStatefullBean $bean)
 {
     if (is_a(CApp::getApp()->getApp(), "CCacheDummy")) {
         if (file_exists($this->cacheDir . $bean->getBeanId())) {
             unlink($this->cacheDir . $bean->getBeanId());
         }
         file_put_contents($this->cacheDir . $bean->getBeanId(), serialize($bean));
     } else {
         CApp::getApp()->cache->set("bean_" . $bean->getBeanId(), $bean);
     }
 }
开发者ID:Rustam44,项目名称:ASUPortalPHP,代码行数:16,代码来源:CBeanManager.class.php



注:本文中的CApp类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP CAppPlugins类代码示例发布时间:2022-05-23
下一篇:
PHP CApi类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap