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

PHP CUtils类代码示例

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

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



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

示例1: actionGetInfo

 /**
  * Получение информации о файле
  */
 public function actionGetInfo()
 {
     $storage = $_POST["_storage"];
     $file = $_POST["_file"];
     $size = $_POST["_size"];
     $index = $_POST["_index"];
     $result = array("isImage" => false, "previewUrl" => "", "fullUrl" => "", "url" => "", "name" => $file, "index" => $index);
     if (file_exists($storage . $file)) {
         // заменяем обратный слэш в адресе на прямой
         $linkWithBackSlash = CUtils::strRight($storage, CORE_CWD) . $file;
         $link = str_replace('\\', '/', $linkWithBackSlash);
         $result["fullUrl"] = WEB_ROOT . $link;
         $result["url"] = $link;
         $result["isImage"] = CUtils::isImage($storage . $file);
         if (CUtils::isImage($storage . $file)) {
             $result["previewUrl"] = WEB_ROOT . "_modules/_thumbnails/?src=" . $result["url"] . "&w=" . $size;
         } else {
             $filetype = CUtils::getMimetype($storage . $file);
             if (file_exists(CORE_CWD . CORE_DS . "images" . CORE_DS . ICON_THEME . CORE_DS . "64x64" . CORE_DS . "mimetypes" . CORE_DS . $filetype . ".png")) {
                 $result["previewUrl"] = WEB_ROOT . "images/" . ICON_THEME . "/64x64/mimetypes/" . $filetype . ".png";
             } else {
                 $result["previewUrl"] = WEB_ROOT . "images/" . ICON_THEME . "/64x64/mimetypes/unknown.png";
             }
         }
     }
     echo json_encode($result);
 }
开发者ID:Rustam44,项目名称:ASUPortalPHP,代码行数:30,代码来源:CUploadController.class.php


示例2: canShared

 /**
  * 是否能被共享
  * @param array $sharePaths    - 数组,有包含user_id的path组成
  * @param string $path         - 包含user_id的path
  * @return bool
  */
 public function canShared($sharePaths, $path)
 {
     $paths = CUtils::assemblyPaths($path);
     $keys = array_keys($paths);
     if (count($keys) > 0) {
         unset($paths[$keys[0]]);
     }
     //
     // 检查path,如果存在于$paths中则父目录存在共享
     //
     foreach ($sharePaths as $k => $sharePath) {
         if (isset($paths[$sharePath])) {
             return false;
         }
     }
     //
     // 检查子目录是否存在共享,如果存在则返回false
     //
     $path .= '/';
     foreach ($sharePaths as $k => $sharePath) {
         if (strpos($sharePath, $path) === 0) {
             return false;
         }
     }
     return true;
 }
开发者ID:youngsun45,项目名称:miniyun,代码行数:32,代码来源:SharesAccessFilter.php


示例3: getResult

 function getResult()
 {
     $this->updateData();
     $q = $this->tables['questions']->getItem(CUtils::_postVar('vote_question', true, 0) ? CUtils::_postVar('vote_question', true, 0) : "publish='on' AND date_beg<'" . date('Y-m-d H:i:s') . "' AND date_end>'" . date('Y-m-d H:i:s') . "'");
     if ($q) {
         $a = $this->tables['answers']->getArraysWhere('question_id=' . $q['id'] . " AND publish='on'");
         $rows = array();
         foreach ($a as $k => $v) {
             $a[$k]['percent'] = round($v['quantity'] ? intval($v['quantity']) / intval($q['quantity']) * 100 : 0, 2);
             if ($a[$k]['quantity']) {
                 $rows[] = array(intval(360 * $a[$k]['percent'] / 100), $a[$k]['color']);
             }
         }
         if ($q['is_dia']) {
             inc_lib('tools/CDiagram.php');
             $dia = new CDiagram();
             $dia->bgcolor = 'EAEAEA';
             if ($dia->draw($rows)) {
                 $this->smarty->assign('vote_dia', '<img src="' . $dia->fname . '" width="' . $dia->width . '" height="' . $dia->height . '">');
             }
         }
         $this->smarty->assign('a', $a);
         $this->smarty->assign('q', $q);
         return $this->smarty->fetch('service/' . $this->props['lang'] . '/vote.result.tpl');
     } else {
         return '';
     }
 }
开发者ID:rawork,项目名称:colors-life,代码行数:28,代码来源:VoteUnit.php


示例4: get_Size

 public static function get_Size($pdo_connection, $catalog_id)
 {
     $db_name = FileConfig::get_Value('db_name', $catalog_id);
     switch (CDB::getDriverName()) {
         case 'mysql':
             // Return N/A for MySQL server prior version 5 (no information_schemas)
             if (version_compare(CDB::getServerVersion(), '5.0.0') >= 0) {
                 // Prepare SQL statment
                 $statment = array('table' => 'information_schema.TABLES', 'fields' => array("table_schema AS 'database', (sum( data_length + index_length) / 1024 / 1024 ) AS 'dbsize'"), 'where' => array("table_schema = '{$db_name}'"), 'groupby' => 'table_schema');
                 $result = CDBUtils::runQuery(CDBQuery::get_Select($statment, $pdo_connection), $pdo_connection);
                 $db_size = $result->fetch();
                 $db_size = $db_size['dbsize'] * 1024 * 1024;
                 return CUtils::Get_Human_Size($db_size);
             } else {
                 echo 'Not supported (' . CDB::getServerVersion() . ') <br />';
             }
             break;
         case 'pgsql':
             $statment = "SELECT pg_database_size('{$db_name}') AS dbsize";
             $result = CDBUtils::runQuery($statment, $pdo_connection);
             $db_size = $result->fetch();
             return CUtils::Get_Human_Size($db_size['dbsize']);
             break;
         case 'sqlite':
             $db_size = filesize(FileConfig::get_Value('db_name', $catalog_id));
             return CUtils::Get_Human_Size($db_size);
             break;
     }
 }
开发者ID:ektich,项目名称:bacula-web,代码行数:29,代码来源:database.model.php


示例5: actionIndex

 public function actionIndex()
 {
     $set = new CRecordSet();
     $query = new CQuery();
     $set->setQuery($query);
     $query->select("com.*");
     $query->leftJoin(TABLE_DIPLOM_PREVIEW_MEMBERS . " as members", "members.comm_id=com.id")->from(TABLE_DIPLOM_PREVIEW_COMISSIONS . " as com")->order("com.date_act desc");
     $showAll = true;
     if (CRequest::getInt("showAll") != 1) {
         $query->condition('com.date_act between "' . date("Y-m-d", strtotime(CUtils::getCurrentYear()->date_start)) . '" and "' . date("Y-m-d", strtotime(CUtils::getCurrentYear()->date_end)) . '"');
         $showAll = false;
     }
     if (CRequest::getString("order") == "person.fio") {
         $direction = "asc";
         if (CRequest::getString("direction") != "") {
             $direction = CRequest::getString("direction");
         }
         $query->innerJoin(TABLE_PERSON . " as person", "com.secretary_id = person.id");
         $query->order("person.fio " . $direction);
     }
     $items = new CArrayList();
     foreach ($set->getPaginated()->getItems() as $ar) {
         $commission = new CDiplomPreviewComission($ar);
         $items->add($commission->getId(), $commission);
     }
     $this->setData("showAll", $showAll);
     $this->setData("commissions", $items);
     $this->setData("paginator", $set->getPaginator());
     $this->addActionsMenuItem(array(array("title" => "Добавить комиссию", "link" => "?action=add", "icon" => "actions/list-add.png")));
     $this->renderView("_diploms/preview_commission/index.tpl");
 }
开发者ID:Rustam44,项目名称:ASUPortalPHP,代码行数:31,代码来源:CDiplomPreviewCommissionController.class.php


示例6: actionGetViewData

 public function actionGetViewData()
 {
     $result = array();
     // комиссии по защите дипломов. показываем только комиссии этого года
     foreach (CActiveRecordProvider::getWithCondition(TABLE_SAB_COMMISSIONS, "year_id=" . CUtils::getCurrentYear()->getId())->getItems() as $ar) {
         $comm = new CSABCommission($ar);
         $value = $comm->title;
         if (!is_null($comm->manager)) {
             $value .= " " . $comm->manager->getName();
         }
         if (!is_null($comm->secretar)) {
             $value .= " (" . $comm->secretar->getName() . ")";
         }
         $diplom = CStaffManager::getDiplom(CRequest::getInt("diplom_id"));
         if (!is_null($diplom)) {
             $cnt = 0;
             foreach ($comm->diploms->getItems() as $d) {
                 if (strtotime($diplom->date_act) == strtotime($d->date_act)) {
                     $cnt++;
                 }
             }
             $value .= " " . $cnt;
         }
         $result[$comm->getId()] = $value;
     }
     return $result;
 }
开发者ID:Rustam44,项目名称:ASUPortalPHP,代码行数:27,代码来源:CSearchCatalogSABCommission.class.php


示例7: getSInsert

 function getSInsert()
 {
     global $PRJ_DIR, $THEME_REF, $smarty;
     if (file_exists($PRJ_DIR . '/templates/admin/components/' . CUtils::_getVar('unit') . '.' . CUtils::_getVar('table') . '.tpl')) {
         return $smarty->fetch('admin/components/' . CUtils::_getVar('unit') . '.' . CUtils::_getVar('table') . '.tpl');
     } else {
         reset($this->t->fields);
         $ret = '';
         $fields = '';
         foreach ($this->t->fields as $k => $v) {
             if (empty($v['readonly'])) {
                 $vis = '';
                 if ($this->t->getDBTableName() == 'table_attributes' && ($v['name'] == 'select_values' || $v['name'] == 'params')) {
                     $vis = ' style="display:none;"';
                 }
                 $fields .= '<tr' . $vis . ' id="add_' . $v['name'] . '" bgcolor="#fafafa"><td class="left" width="180" align="left"><b>' . $v['title'] . '</b>' . $this->getHelpLink($k, $v) . $this->getTemplateName($v) . '</td><td class="right">';
                 $ft = $this->t->createFieldType($v);
                 $fields .= $ft->getInput() . '</td></tr>' . "\n";
             }
         }
         $ret .= '<form enctype="multipart/form-data" method="post" name="frmInsert" id="frmInsert" action="' . $this->fullRef . '&action=insert">';
         $ret .= '<input type="hidden" id="utype" name="utype" value="0">';
         $ret .= $this->getTableHeader();
         $ret .= '<tr">' . "\n";
         $ret .= '<td><b>Добавить</b><a name=add></a><br><img src="' . $THEME_REF . '/img/0.gif" width="150" height="1"></td>' . "\n";
         $ret .= '<td><div class="empty"></div></td></tr>' . "\n";
         $ret .= $fields;
         $ret .= '</table><div class="ctlbtns"><input type="button" class="adm-btn" onClick="preSubmit(\'frmInsert\', 1)" value="Применить"><input type="button" class="adm-btn" onClick="preSubmit(\'frmInsert\', 0)" value="Сохранить"><input type="button" class="adm-btn" onClick="window.location = \'' . (!empty($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : $this->fullRef) . '\'" value="Отменить"></div></form>' . "\n";
         return $ret;
     }
 }
开发者ID:rawork,项目名称:colors-life,代码行数:31,代码来源:proc.s_insert.inc.php


示例8: getValues

 private function getValues()
 {
     $values = array();
     if (array_key_exists('source', $this->params)) {
         $source = $this->params['source'];
         if (CUtils::strLeft($source, ".") == "class") {
             $class = CUtils::strRight($source, ".");
             if (array_key_exists('properties', $this->params)) {
                 $object = new $class(array("properties" => $this->params['properties']));
             } else {
                 $object = new $class();
             }
             $sourceParams = $this->params['params'];
             // для совместимости их надо положить в запрос
             foreach ($sourceParams as $key => $value) {
                 $_POST[$key] = $value;
             }
             $values = $object->actionGetViewData();
         } else {
             $taxonomy = CTaxonomyManager::getTaxonomy($this->params['source']);
             $values = $taxonomy->getTermsList();
         }
     } elseif (array_key_exists('values', $this->params)) {
         $values = $this->params['values'];
     }
     return $values;
 }
开发者ID:Rustam44,项目名称:ASUPortalPHP,代码行数:27,代码来源:CStatefullFormWidget_Select.class.php


示例9: getDiskFreeSpace

 public function getDiskFreeSpace()
 {
     if (file_exists(BASE) == false) {
         CUtils::MkDirs(BASE);
     }
     return @disk_free_space(BASE);
 }
开发者ID:youngsun45,项目名称:miniyun,代码行数:7,代码来源:HomePageBiz.php


示例10: __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


示例11: getHandlerNames

 /**
  * Генератор названий обработчиков
  *
  * @param string $event
  * @param string $element
  * @return array
  */
 private function getHandlerNames($event = '', $element = '')
 {
     // получим основные названия обработчиков
     $handlers = array();
     $handlers[] = $event . '_' . $element;
     $e = $element;
     while (mb_strpos($e, '_') !== false) {
         $e = CUtils::strLeftBack($e, '_');
         $handlers[] = $event . '_' . $e;
     }
     $handlers[] = $event;
     // для цифровых обработчиков сгенерируем нецифровые аналоги
     $pattern = '/(_[0-9]+)/';
     foreach ($handlers as $handler) {
         if (preg_match($pattern, $handler) > 0) {
             $h = preg_replace($pattern, '', $handler);
             if (!in_array($h, $handlers)) {
                 $handlers[] = $h;
             }
         }
     }
     // сгенерируем дополнительно полный список
     $result = array();
     foreach ($handlers as $handler) {
         $result[] = 'handle_before_' . $handler;
         $result[] = 'handle_' . $handler;
         $result[] = 'handle_after_' . $handler;
     }
     // для отладки пропишем все обработчики в бин
     $this->getStatefullFormBean()->getElement($element)->setHandlers($result);
     return $result;
 }
开发者ID:Rustam44,项目名称:ASUPortalPHP,代码行数:39,代码来源:CStatefullFormController.class.php


示例12: write

 public static function write($sMessage)
 {
     global $db;
     $sIPAddress = empty($_SERVER['REMOTE_ADDR']) ? '' : $_SERVER['REMOTE_ADDR'];
     $sUserName = CUtils::_sessionVar('user');
     $sQuery = "\r\n\t\t\t\tINSERT INTO\r\n\t\t\t\t\tsystem_log(credate, ip_address, user_name, description) \r\n\t\t\t\tVALUES\r\n\t\t\t\t\t(NOW(), '{$sIPAddress}','{$sUserName}', '{$sMessage}')\r\n\t\t\t";
     $db->execQuery('log', $sQuery);
 }
开发者ID:rawork,项目名称:colors-life,代码行数:8,代码来源:CLog.php


示例13: updateFileMeta

 /**
  * 更新文件meta信息
  * @param string $file_path
  * @param string $meta_key
  * @param string $meta_value
  */
 public static function updateFileMeta($file_path, $meta_key, $meta_value)
 {
     $meta_value = CUtils::real_escape_string($meta_value);
     $sql = "UPDATE " . DB_PREFIX . "_file_metas ";
     $sql .= "SET meta_value = '{$meta_value}', updated_at = now() ";
     $sql .= "WHERE file_path=\"{$file_path}\" AND meta_key=\"{$meta_key}\"";
     $db_manager = MDbManager::getInstance();
     return $db_manager->updateDb($sql);
 }
开发者ID:youngsun45,项目名称:miniyun,代码行数:15,代码来源:MFileMetas.php


示例14: isTextField

 /**
  * @return bool
  */
 public function isTextField()
 {
     if ($this->type == "text") {
         return true;
     } elseif (CUtils::strLeft($this->type, "(") == "varchar") {
         return true;
     }
     return false;
 }
开发者ID:Rustam44,项目名称:ASUPortalPHP,代码行数:12,代码来源:CDbTableField.class.php


示例15: getStatic

 public function getStatic()
 {
     global $PRJ_REF;
     $ret = '';
     if ($this->dbValue) {
         $ret = '<a href="' . $PRJ_REF . $this->dbValue . '">' . $this->dbValue . '</a>&nbsp;(' . CUtils::getFileSize($this->dbValue) . ')';
     }
     return $ret;
 }
开发者ID:rawork,项目名称:colors-life,代码行数:9,代码来源:file.php


示例16: getText

 function getText()
 {
     if (CUtils::_postVar('utype')) {
         $path = str_replace(stristr($_SERVER['HTTP_REFERER'], '&message'), '', $_SERVER['HTTP_REFERER']);
         header('location: ' . $path . '&message=' . ($this->t->updateGlobals() ? urlencode('Обновлено') : urlencode('Ошибка обновления')));
     } else {
         $this->messageAction($this->t->updateGlobals() ? 'Обновлено' : 'Ошибка обновления');
     }
 }
开发者ID:rawork,项目名称:colors-life,代码行数:9,代码来源:proc.update.inc.php


示例17: getBody

 function getBody()
 {
     $ret = $this->smarty->fetch('service/' . $this->props['lang'] . '/search.form.tpl');
     $max_per_page = 20;
     $this->page = CUtils::_getVar('page', true, 1);
     if (CUtils::_getVar('text')) {
         $search_array = array();
         $simple_search_array = explode(' ', CUtils::_getVar('text'));
         foreach ($simple_search_array as $ssa) {
             inc_lib('tools/stemming/stemming.php');
             $ssa = PorterStem::stemming($ssa);
             $search_array[] = $ssa;
         }
         if (count($search_array)) {
             $results = $this->getResults($search_array);
         } else {
             $results = $this->getResults(addslashes($this->text));
         }
         $this->smarty->assign('search_text', addslashes(CUtils::_getVar('text')));
         if (sizeof($results) > 0) {
             $pages_cnt = ceil(sizeof($results) / $max_per_page);
             if ($pages_cnt > 1) {
                 $pages = '<div>';
                 if ($this->page > 1) {
                     $ref = '?text=' . urlencode(CUtils::_getVar('text')) . '&page=' . ($this->page - 1);
                     $pages .= '<a title="назад" href="' . $ref . '">&larr;</a>';
                 }
                 for ($i = 1; $i <= $pages_cnt; $i++) {
                     $pages .= $i == $this->page ? ' ' . $i . ' ' : ' <a href="?text=' . urlencode(CUtils::_getVar('text')) . '&page=' . $i . '">' . $i . '</a> ';
                 }
                 if ($this->page < $pages_cnt) {
                     $ref = '?text=' . urlencode(CUtils::_getVar('text')) . '&page=' . ($this->page + 1);
                     $pages .= '<a title="вперед" href="' . $ref . '">&rarr;</a>';
                 }
                 $pages .= '</div>';
                 $this->smarty->assign('ptext', $pages);
             }
             if ($this->page == $pages_cnt && sizeof($results) % $max_per_page > 0) {
                 $max_per_page_cur = count($results) % $max_per_page;
             } else {
                 $max_per_page_cur = $max_per_page;
             }
             $items = array();
             for ($i = 1; $i <= $max_per_page_cur; $i++) {
                 $j = $i + ($this->page - 1) * $max_per_page;
                 $results[$j - 1]['num'] = $j;
                 $items[] = $results[$j - 1];
             }
             $this->smarty->assign('items', $items);
             $ret .= $this->smarty->fetch('service/' . $this->props['lang'] . '/search.list.tpl');
         } else {
             $ret .= $this->smarty->fetch('service/' . $this->props['lang'] . '/search.no.tpl');
         }
     }
     return $ret;
 }
开发者ID:rawork,项目名称:colors-life,代码行数:56,代码来源:SearchUnit.php


示例18: getStatic

 public function getStatic()
 {
     global $PRJ_REF;
     $ret = '';
     if ($this->dbValue) {
         $path = pathinfo($this->dbValue);
         $ret = $path['basename'] . '&nbsp;' . CUtils::getFileSize($this->dbValue);
     }
     return $ret;
 }
开发者ID:rawork,项目名称:colors-life,代码行数:10,代码来源:template.php


示例19: getInput

 public function getInput($value = '', $name = '')
 {
     $name = $name ? $name : $this->getName();
     $value = $value ? $value : $this->dbValue;
     $input_id = strtr($name, '[]', '__');
     $ret = '<table width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td width="100%"><input type="text" readonly style="width:100%;" value="' . $this->getStatic() . '" size="62" id="' . $input_id . '_title">';
     $ret .= '<input type="hidden" name="' . $name . '" value="' . $value . '" id="' . $input_id . '">';
     $ret .= '</td><td><input class="butt" type="button" value="&hellip;" onClick="show_list_popup(\'' . $input_id . '\',\'' . CUtils::_getVar('unit') . '_' . CUtils::_getVar('table') . '\',\'' . $this->getName() . '\', \'' . CUtils::_getVar('id', true, 0) . '\',\'' . $value . '\');"></td></tr></table>';
     return $ret;
 }
开发者ID:rawork,项目名称:colors-life,代码行数:10,代码来源:select_list.php


示例20: actionAdd

 public function actionAdd()
 {
     $commission = new CSABCommission();
     $form = new CSABCommissionForm();
     $commission->year_id = CUtils::getCurrentYear()->getId();
     $form->commission = $commission;
     $this->setData("form", $form);
     $this->addActionsMenuItem(array(array("title" => "Назад", "link" => "index.php?action=index", "icon" => "actions/edit-undo.png")));
     $this->renderView("_state_attestation/add.tpl");
 }
开发者ID:Rustam44,项目名称:ASUPortalPHP,代码行数:10,代码来源:CSABComissionController.class.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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