本文整理汇总了PHP中ConvertUtil类的典型用法代码示例。如果您正苦于以下问题:PHP ConvertUtil类的具体用法?PHP ConvertUtil怎么用?PHP ConvertUtil使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ConvertUtil类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: exportSms
public static function exportSms($id)
{
$ids = is_array($id) ? $id : explode(",", $id);
header("Content-Type:application/vnd.ms-excel");
$fileName = ConvertUtil::iIconv(Ibos::lang("SMS export name", "dashboard.default", array("{date}" => date("Ymd"))), CHARSET, "gbk");
header("Content-Disposition: attachment;filename={$fileName}.csv");
header("Cache-Control: max-age = 0");
$head = array("ID", Ibos::lang("Sender", "dashboard.default"), Ibos::lang("Recipient", "dashboard.default"), Ibos::lang("Membership module", "dashboard.default"), Ibos::lang("Recipient phone number", "dashboard.default"), Ibos::lang("Content", "dashboard.default"), Ibos::lang("Result", "dashboard.default"), Ibos::lang("Send time", "dashboard.default"));
foreach ($head as &$header) {
$header = ConvertUtil::iIconv($header, CHARSET, "gbk");
}
$fp = fopen("php://output", "a");
fputcsv($fp, $head);
$cnt = 0;
$limit = 100;
$system = Ibos::lang("System", "dashboard.default");
foreach (NotifySms::model()->fetchAll(sprintf("FIND_IN_SET(id,'%s')", implode(",", $ids))) as $row) {
if ($limit == $cnt) {
ob_flush();
flush();
$cnt = 0;
}
$data = array($row["id"], ConvertUtil::iIconv($row["uid"] == 0 ? $system : User::model()->fetchRealnameByUid($row["uid"]), CHARSET, "gbk"), ConvertUtil::iIconv(User::model()->fetchRealnameByUid($row["touid"]), CHARSET, "gbk"), $row["module"], $row["mobile"], ConvertUtil::iIconv($row["content"], CHARSET, "gbk"), ConvertUtil::iIconv($row["return"], CHARSET, "gbk"), date("Y-m-d H:i:s", $row["ctime"]));
fputcsv($fp, $data);
}
exit;
}
示例2: updateTable
public static function updateTable($flowId, $structure = array())
{
$tableName = sprintf("{{flow_data_%d}}", intval($flowId));
if (!self::tableExists($tableName)) {
if (!self::createTable($tableName, $structure)) {
return false;
}
return true;
}
if ($structure) {
$rows = Ibos::app()->db->createCommand()->setText("SHOW FIELDS FROM " . $tableName)->queryAll();
$fields = ConvertUtil::getSubByKey($rows, "Field");
$items = array();
foreach ($structure as $eName => $config) {
$field = strtolower(trim($eName));
if (!in_array($field, $fields)) {
if (substr($field, 0, 5) == "data_") {
$items[] = "ALTER TABLE " . $tableName . " ADD `{$field}` text NOT NULL;";
}
}
}
if (!empty($items)) {
Ibos::app()->db->createCommand()->setText(implode("\n", $items))->execute();
}
}
return true;
}
示例3: showDetail
protected function showDetail()
{
$repid = intval(EnvUtil::getRequest("repid"));
$isShowTitle = EnvUtil::getRequest("isShowTitle");
$fromController = EnvUtil::getRequest("fromController");
$report = Report::model()->fetchByPk($repid);
$uid = Ibos::app()->user->uid;
Report::model()->addReaderuid($report, $uid);
$record = ReportRecord::model()->fetchAllRecordByRep($report);
$attachs = array();
if (!empty($report["attachmentid"])) {
$attachs = AttachUtil::getAttach($report["attachmentid"], true, true, false, false, true);
}
$readers = array();
if (!empty($report["readeruid"])) {
$readerArr = explode(",", $report["readeruid"]);
$readers = User::model()->fetchAllByPk($readerArr);
}
$stampUrl = "";
if ($report["stamp"] != 0) {
$stamp = Stamp::model()->fetchStampById($report["stamp"]);
$stampUrl = FileUtil::fileName(Stamp::STAMP_PATH) . $stamp;
}
$report["addtime"] = ConvertUtil::formatDate($report["addtime"], "u");
$params = array("lang" => Ibos::getLangSource("report.default"), "repid" => $repid, "report" => $report, "uid" => $uid, "orgPlanList" => $record["orgPlanList"], "outSidePlanList" => $record["outSidePlanList"], "nextPlanList" => $record["nextPlanList"], "attachs" => $attachs, "readers" => $readers, "stampUrl" => $stampUrl, "fromController" => $fromController, "isShowTitle" => $isShowTitle, "allowComment" => $this->getIsAllowComment($fromController));
$detailAlias = "application.modules.report.views.detail";
$detailView = $this->renderPartial($detailAlias, $params, true);
$this->ajaxReturn(array("data" => $detailView, "isSuccess" => true));
}
示例4: getUids
public function getUids($content, $extraUids = null, $lessUids = null)
{
preg_match_all($this->_atRegex, $content, $matches);
$unames = $matches[1];
$map = "realname in ('" . implode("','", $unames) . "')";
$ulist = User::model()->fetchAll($map);
$matchUids = ConvertUtil::getSubByKey($ulist, "uid");
if (empty($matchUids) && !empty($extraUids)) {
if (!empty($lessUids)) {
foreach ($lessUids as $k => $v) {
if (in_array($v, $extraUids)) {
unset($extraUids[$k]);
}
}
}
return is_array($extraUids) ? $extraUids : array($extraUids);
}
$suid = array();
foreach ($matchUids as $v) {
!in_array($v, $suid) && ($suid[] = (int) $v);
}
if (!empty($lessUids)) {
foreach ($suid as $k => $v) {
if (in_array($v, $lessUids)) {
unset($suid[$k]);
}
}
}
return array_unique(array_filter(array_merge($suid, (array) $extraUids)));
}
示例5: handleInitEnvironment
public function handleInitEnvironment($event)
{
Ibos::app()->performance->startClock();
Ibos::app()->performance->startMemoryUsageMarker();
define("STATICURL", Ibos::app()->assetManager->getBaseUrl());
define("IN_MOBILE", EnvUtil::checkInMobile());
define("IN_DASHBOARD", EnvUtil::checkInDashboard());
define("TIMESTAMP", time());
define("IN_APP", EnvUtil::checkInApp());
$this->setTimezone();
if (function_exists("ini_get")) {
$memorylimit = @ini_get("memory_limit");
if ($memorylimit && ConvertUtil::ConvertBytes($memorylimit) < 33554432 && function_exists("ini_set")) {
ini_set("memory_limit", "128m");
}
}
$global = array("timestamp" => TIMESTAMP, "version" => VERSION, "clientip" => EnvUtil::getClientIp(), "referer" => "", "charset" => CHARSET, "authkey" => "", "newversion" => 0, "config" => array(), "setting" => array(), "user" => array(), "cookie" => array(), "session" => array(), "lunar" => DateTimeUtil::getlunarCalendar(), "title" => MainUtil::getIncentiveWord(), "staticurl" => STATICURL);
$global["phpself"] = $this->getScriptUrl();
$sitePath = substr($global["phpself"], 0, strrpos($global["phpself"], "/"));
$global["isHTTPS"] = isset($_SERVER["HTTPS"]) && strtolower($_SERVER["HTTPS"]) != "off" ? true : false;
$global["siteurl"] = StringUtil::ihtmlSpecialChars("http" . ($global["isHTTPS"] ? "s" : "") . "://" . $_SERVER["HTTP_HOST"] . $sitePath . "/");
$url = parse_url($global["siteurl"]);
$global["siteroot"] = isset($url["path"]) ? $url["path"] : "";
$global["siteport"] = empty($_SERVER["SERVER_PORT"]) || $_SERVER["SERVER_PORT"] == "80" || $_SERVER["SERVER_PORT"] == "443" ? "" : ":" . $_SERVER["SERVER_PORT"];
$config = @(include PATH_ROOT . "/system/config/config.php");
if (empty($config)) {
throw new NotFoundException(Ibos::Lang("Config not found", "error"));
} else {
$global["config"] = $config;
}
Ibos::app()->setting->copyFrom($global);
}
示例6: actionIndex
public function actionIndex()
{
$op = EnvUtil::getRequest("op");
$op = in_array($op, array("dept", "letter")) ? $op : "dept";
$params = array();
if ($op == "letter") {
$params["datas"] = $this->getDataByLetter();
} else {
$params["datas"] = $this->getDataByDept();
}
$userDatas = array();
if (!empty($params["datas"])) {
foreach ($params["datas"] as $datas) {
$userDatas = $op == "dept" ? array_merge($userDatas, $datas["users"]) : array_merge($userDatas, $datas);
}
}
$params["uids"] = implode(",", ConvertUtil::getSubByKey($userDatas, "uid"));
$uid = Ibos::app()->user->uid;
$params["cuids"] = Contact::model()->fetchAllConstantByUid($uid);
$this->setPageTitle(Ibos::lang("Contact"));
$this->setPageState("breadCrumbs", array(array("name" => Ibos::lang("Contact"), "url" => $this->createUrl("defalut/index")), array("name" => Ibos::lang("Company contact"))));
$view = $op == "letter" ? "letter" : "dept";
$params["allLetters"] = $this->allLetters;
$this->render($view, $params);
}
示例7: export
public static function export($idstr)
{
$idArr = is_array($idstr) ? $idstr : explode(",", $idstr);
if (1 < count($idArr)) {
$zip = new Zip();
$exportFileName = Ibos::lang("Form export file pack", "workflow.default", array("{date}" => date("Y-m-d")));
$zipFileName = FileUtil::getTempPath() . "/" . TIMESTAMP . ".zip";
foreach ($idArr as $id) {
$form = self::handleExportSingleForm($id);
$zip->addFile($form["content"], sprintf("%s.html", ConvertUtil::iIconv($form["title"], CHARSET, "gbk")));
}
$fp = fopen($zipFileName, "w");
if (@fwrite($fp, $zip->file()) !== false) {
header("Cache-control: private");
header("Content-type: application/octet-stream");
header("Accept-Ranges: bytes");
header("Content-Length: " . sprintf("%u", FileUtil::fileSize($zipFileName)));
header("Content-Disposition: attachment; filename=" . $exportFileName . ".zip");
readfile($zipFileName);
exit;
}
} else {
$id = implode(",", $idArr);
$form = self::handleExportSingleForm($id);
ob_end_clean();
header("Cache-control: private");
header("Content-type: text/plain");
header("Accept-Ranges: bytes");
header("Accept-Length: " . strlen($form["content"]));
header("Content-Disposition: attachment; filename=" . $form["title"] . ".html");
echo $form["content"];
}
}
示例8: getMemoryMarkerUsage
public function getMemoryMarkerUsage($format = true)
{
$usage = (int) memory_get_usage() - $this->memoryUsage;
if ($format) {
return ConvertUtil::sizeCount($usage);
}
return $usage;
}
示例9: actionAllDiggList
public function actionAllDiggList()
{
$feedId = intval(EnvUtil::getRequest("feedid"));
$result = FeedDigg::model()->fetchUserList($feedId, 5);
$uids = ConvertUtil::getSubByKey($result, "uid");
$followStates = Follow::model()->getFollowStateByFids(Ibos::app()->user->uid, $uids);
$this->renderPartial("alldigglist", array("list" => $result, "followstates" => $followStates, "feedid" => $feedId));
}
示例10: fetchAllPositionIdByUid
public function fetchAllPositionIdByUid($uid)
{
static $uids = array();
if (!isset($uids[$uid])) {
$posids = $this->fetchAll(array("select" => "positionid", "condition" => "`uid` = :uid", "params" => array(":uid" => $uid)));
$uids[$uid] = ConvertUtil::getSubByKey($posids, "positionid");
}
return $uids[$uid];
}
示例11: delClear
public function delClear($id, $uid)
{
$fidArr = Yii::app()->db->createCommand()->select("fid")->from($this->tableName())->where("FIND_IN_SET(webid,'{$id}') AND uid = {$uid}")->queryAll();
$fids = ConvertUtil::getSubByKey($fidArr, "fid");
$fid = implode(",", $fids);
Yii::app()->db->createCommand()->delete("{{email_folder}}", "FIND_IN_SET(fid,'{$fid}') AND uid = {$uid}");
Yii::app()->db->createCommand()->update("{{email}}", array("fid" => 1), "FIND_IN_SET(fid,'{$fid}') AND toid = {$uid}");
return $this->deleteAll("FIND_IN_SET(webid,'{$id}')");
}
示例12: getTableStatus
public static function getTableStatus($tableName, $formatSize = true)
{
$status = Ibos::app()->db->createCommand()->setText("SHOW TABLE STATUS LIKE '{{" . str_replace("_", "\\_", $tableName) . "}}'")->queryRow();
if ($formatSize) {
$status["Data_length"] = ConvertUtil::sizeCount($status["Data_length"]);
$status["Index_length"] = ConvertUtil::sizeCount($status["Index_length"]);
}
return $status;
}
示例13: fetchAuidByUid
public function fetchAuidByUid($uid)
{
$attentions = $this->fetchAll("uid = :uid", array(":uid" => $uid));
$aUids = array();
if (!empty($attentions)) {
$aUids = ConvertUtil::getSubByKey($attentions, "auid");
}
return $aUids;
}
示例14: beforeAction
public function beforeAction($action)
{
if (!Ibos::app()->user->isGuest) {
$param = ConvertUtil::implodeArray(array("GET" => $_GET, "POST" => $_POST), array("username", "password", "formhash"));
$action = $action->getId();
$log = array("user" => Ibos::app()->user->username, "ip" => Ibos::app()->setting->get("clientip"), "action" => $action, "param" => $param);
Log::write($log, "admincp", sprintf("module.dashboard.%s", $action));
}
return true;
}
示例15: handleList
protected function handleList($runProcess)
{
foreach ($runProcess as &$run) {
$run["user"] = User::model()->fetchByUid($run["beginuser"]);
$run["begintime"] = ConvertUtil::formatDate($run["begintime"], "u");
$param = array("runid" => $run["runid"], "flowid" => $run["flowid"]);
$run["key"] = WfCommonUtil::param($param);
}
return array("list" => $runProcess);
}