本文整理汇总了PHP中intVal函数的典型用法代码示例。如果您正苦于以下问题:PHP intVal函数的具体用法?PHP intVal怎么用?PHP intVal使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了intVal函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Execute
public function Execute()
{
if (!CModule::IncludeModule("calendar")) {
return CBPActivityExecutionStatus::Closed;
}
$rootActivity = $this->GetRootActivity();
$documentId = $rootActivity->GetDocumentId();
$documentService = $this->workflow->GetService("DocumentService");
$fromTs = CCalendar::Timestamp($this->CalendarFrom);
$toTs = $this->CalendarTo == '' ? $fromTs : CCalendar::Timestamp($this->CalendarTo);
$arFields = array("CAL_TYPE" => !$this->CalendarType ? 'user' : $this->CalendarType, "NAME" => trim($this->CalendarName) == '' ? GetMessage('EC_DEFAULT_EVENT_NAME') : $this->CalendarName, "DESCRIPTION" => $this->CalendarDesrc, "SKIP_TIME" => date('H:i', $fromTs) == '00:00' && date('H:i', $toTs) == '00:00', "IS_MEETING" => false, "RRULE" => false);
if ($fromTs == $toTs && !$arFields["SKIP_TIME"]) {
$toTs += 3600;
}
$arFields['DATE_FROM'] = CCalendar::Date($fromTs);
$arFields['DATE_TO'] = CCalendar::Date($toTs);
if ($this->CalendarSection && intVal($this->CalendarSection) > 0) {
$arFields['SECTIONS'] = array(intVal($this->CalendarSection));
}
if ($this->CalendarOwnerId || $arFields["CAL_TYPE"] != "user" && $arFields["CAL_TYPE"] != "group") {
$arFields["OWNER_ID"] = $this->CalendarOwnerId;
$eventId = CCalendar::SaveEvent(array('arFields' => $arFields, 'autoDetectSection' => true));
} else {
$arCalendarUser = CBPHelper::ExtractUsers($this->CalendarUser, $documentId);
foreach ($arCalendarUser as $calendarUser) {
$arFields["CAL_TYPE"] = "user";
$arFields["OWNER_ID"] = $calendarUser;
$eventId = CCalendar::SaveEvent(array('arFields' => $arFields, 'autoDetectSection' => true));
}
}
return CBPActivityExecutionStatus::Closed;
}
示例2: index
public function index($argv)
{
$this->stdout("Which environment do you want the application to be initialized in?\n\n");
$i = 1;
$envs = [];
foreach ($this->config as $name => $value) {
$this->stdout($i . '. ' . $name . "\n");
$envs[$i] = $name;
$i++;
}
$in = $this->stdin();
if ($in === 'q') {
return;
}
$in = intVal($in);
if ($in >= $i) {
$this->error('There is no environment under number ' . $in);
return;
}
if (!$this->confirm("Are you sure you want to initialize the selected environment?")) {
return;
}
$config = $this->config[$envs[$in]];
$this->env_copy($config['path'], path('root'));
if (isset($config['rights'])) {
$this->set_rights($config['rights']);
}
}
示例3: getUserItems
function getUserItems($feed_ids, $user_id, $start, $start_time, $view_all_items)
{
$user_id = $this->escape($user_id);
//multiple feeds or not
if (is_array($feed_ids)) {
$ids = implode(',', $this->escapeArray($feed_ids));
} else {
$ids = $feed_ids;
}
if (empty($ids)) {
return array();
}
$limit = '';
if (!is_null($start)) {
$start = intVal($start);
$limit = "LIMIT {$start},20";
}
$hide_lus = "AND lus.user_id IS NULL ";
if ($view_all_items) {
$hide_lus = '';
}
$query = "SELECT items.id, lus.user_id AS lu, items.item_sid, items.feed_id, items.title, items.content, items.date, items.link, items.author, items.picture, " . "likes.user_id AS s_like " . "FROM items " . "LEFT JOIN lus " . "ON (items.item_sid = lus.item_sid AND lus.user_id = {$user_id} AND lus.time <= {$start_time}) " . "LEFT JOIN likes " . "ON (items.item_sid = likes.item_sid AND likes.user_id = {$user_id}) " . "LEFT JOIN items_filtered AS f " . "ON (items.item_sid = f.item_sid AND f.user_id = {$user_id}) " . "WHERE items.feed_id IN ({$ids}) " . "AND f.user_id IS NULL " . $hide_lus . "AND items.date <= {$start_time} " . "AND (likes.user_id IS NULL OR likes.user_id = {$user_id}) " . "ORDER BY items.date DESC " . $limit;
$result = $this->query($query);
return $result;
}
示例4: updateAction
public function updateAction()
{
/**
* 记录日志
*/
$log = "数据用户组修改入库\n\nServerIp:\n" . $this->request->getServer('SERVER_ADDR') . "\n\nGET:\n" . var_export($_GET, true) . "\n\nPOST:\n" . var_export($_POST, true);
$this->oLogManager->push('log', $log);
//检查权限
$this->manager->checkMenuPermission($this->sign, Widget_Manager::MENU_PURVIEW_UPDATE);
$data = $this->request->from('name', 'ClassId');
$group_id = $this->request->group_id;
if (!intVal($group_id)) {
echo json_encode(array('errno' => 1));
return false;
}
if (empty($data['name'])) {
echo json_encode(array('errno' => 2));
return false;
}
$oGroup = new Widget_Group();
$res = $oGroup->update($group_id, $data);
if (!$res) {
echo json_encode(array('errno' => 9));
return false;
}
echo json_encode(array('errno' => 0));
return true;
}
示例5: faqAction
/**
* action faq
*
* @return void
*/
public function faqAction()
{
$this->contentObj = $this->configurationManager->getContentObject();
$this->settings['contentID'] = md5($this->contentObj->data['uid']);
$template = $this->configuration->template();
if ($template == 1) {
$detail = 0;
if ($this->request->hasArgument('faq')) {
$data = $this->request->getArguments('faq');
if (intVal($data['faq'])) {
$detail = $data['faq'];
}
}
$faq = $this->fAQRepository->getFAQData($detail);
if ($this->settings['main']['displayFAQ'] == 'CategoryGroupWise' && $detail == 0) {
$faq = $this->fAQRepository->getFAQCategoryData($faq, $this->settings['main']['categories']);
}
if (count($faq) == 0) {
$template = array("error" => array('no_records'));
}
$this->view->assign('FAQ', $faq);
$this->view->assign('detail', $detail);
}
$this->view->assign('template', $template);
$this->view->assign('settings', $this->settings);
// Include Additional Data
$this->configuration->additionalData();
}
示例6: CheckFields
public static function CheckFields($ACTION, &$arFields, $ID = 0)
{
global $DB;
if ($ACTION != "ADD" && IntVal($ID) <= 0) {
$GLOBALS["APPLICATION"]->ThrowException("System error 870164", "ERROR");
return false;
}
if ((is_set($arFields, "SITE_ID") || $ACTION == "ADD") && (is_array($arFields["SITE_ID"]) && count($arFields["SITE_ID"]) <= 0 || !is_array($arFields["SITE_ID"]) && strlen($arFields["SITE_ID"]) <= 0)) {
$GLOBALS["APPLICATION"]->ThrowException(GetMessage("SONET_GS_EMPTY_SITE_ID"), "EMPTY_SITE_ID");
return false;
} elseif (is_set($arFields, "SITE_ID")) {
if (!is_array($arFields["SITE_ID"])) {
$arFields["SITE_ID"] = array($arFields["SITE_ID"]);
}
foreach ($arFields["SITE_ID"] as $v) {
$dbResult = CSite::GetByID($v);
if (!$dbResult->Fetch()) {
$GLOBALS["APPLICATION"]->ThrowException(str_replace("#ID#", $v, GetMessage("SONET_GS_ERROR_NO_SITE")), "ERROR_NO_SITE");
return false;
}
}
}
if ((is_set($arFields, "NAME") || $ACTION == "ADD") && strlen($arFields["NAME"]) <= 0) {
$GLOBALS["APPLICATION"]->ThrowException(GetMessage("SONET_GS_EMPTY_NAME"), "EMPTY_NAME");
return false;
}
if (is_set($arFields, "SORT") || $ACTION == "ADD") {
$arFields["SORT"] = intVal($arFields["SORT"]) > 0 ? intVal($arFields["SORT"]) : 100;
}
return True;
}
示例7: OnPrepareComments
function OnPrepareComments()
{
$arResult =& $this->component->arResult;
$arParams =& $this->component->arParams;
$arMessages =& $arResult['MESSAGES'];
$arResult['FILES'] = array();
if (!empty($arMessages)) {
$res = array_keys($arMessages);
$arFilter = array("FORUM_ID" => $arParams["FORUM_ID"], "TOPIC_ID" => $arResult["FORUM_TOPIC_ID"], "APPROVED_AND_MINE" => $GLOBALS["USER"]->GetId(), ">MESSAGE_ID" => intVal(min($res)) - 1, "<MESSAGE_ID" => intVal(max($res)) + 1);
if ($arResult["USER"]["RIGHTS"]["MODERATE"] == "Y") {
unset($arFilter["APPROVED_AND_MINE"]);
}
$db_files = CForumFiles::GetList(array("MESSAGE_ID" => "ASC"), $arFilter);
if ($db_files && ($res = $db_files->Fetch())) {
do {
$res["SRC"] = CFile::GetFileSRC($res);
if ($arMessages[$res["MESSAGE_ID"]]["~ATTACH_IMG"] == $res["FILE_ID"]) {
// attach for custom
$arMessages[$res["MESSAGE_ID"]]["~ATTACH_FILE"] = $res;
$arMessages[$res["MESSAGE_ID"]]["ATTACH_IMG"] = CFile::ShowFile($res["FILE_ID"], 0, $this->imageSize, $this->imageSize, true, "border=0", false);
$arMessages[$res["MESSAGE_ID"]]["ATTACH_FILE"] = $arMessages[$res["MESSAGE_ID"]]["ATTACH_IMG"];
}
$arMessages[$res["MESSAGE_ID"]]["FILES"][$res["FILE_ID"]] = $res;
$arResult['FILES'][$res["FILE_ID"]] = $res;
} while ($res = $db_files->Fetch());
}
}
}
示例8: __array_stretch
function __array_stretch($arGroup, $depth = 0)
{
$arResult = array();
if (intVal($arGroup["ID"]) > 0) {
$arResult["GROUP_" . $arGroup["ID"]] = $arGroup;
unset($arResult["GROUP_" . $arGroup["ID"]]["GROUPS"]);
unset($arResult["GROUP_" . $arGroup["ID"]]["FORUM"]);
$arResult["GROUP_" . $arGroup["ID"]]["DEPTH"] = $depth;
$arResult["GROUP_" . $arGroup["ID"]]["TYPE"] = "GROUP";
}
if (array_key_exists("FORUMS", $arGroup)) {
foreach ($arGroup["FORUMS"] as $res) {
$arResult["FORUM_" . $res["ID"]] = $res;
$arResult["FORUM_" . $res["ID"]]["DEPTH"] = $depth;
$arResult["FORUM_" . $res["ID"]]["TYPE"] = "FORUM";
}
}
if (array_key_exists("GROUPS", $arGroup)) {
$depth++;
foreach ($arGroup["GROUPS"] as $key => $val) {
$res = __array_stretch($arGroup["GROUPS"][$key], $depth);
$arResult = array_merge($arResult, $res);
}
}
return $arResult;
}
示例9: getItems
public function getItems()
{
$items = array();
// get filter ID by attribute code
$id = Mage::getResourceModel('amshopby/filter')->getIdByCode($this->getAttributeCode());
if ($id) {
$items = Mage::getResourceModel('amshopby/value_collection')->addFieldToFilter('is_featured', 1)->addFieldToFilter('filter_id', $id)->addValue();
if ($this->getRandom()) {
$items->setOrder('rand()');
} else {
$items->setOrder('featured_order', 'asc');
$items->setOrder('value', 'asc');
$items->setOrder('title', 'asc');
}
if ($this->getLimit()) {
$items->setPageSize(intVal($this->getLimit()));
}
/** @var Amasty_Shopby_Helper_Url $hlp */
$hlp = Mage::helper('amshopby/url');
$base = Mage::getBaseUrl('media') . 'amshopby/';
foreach ($items as $item) {
if ($item->getImgBig()) {
$item->setImgBig($base . $item->getImgBig());
}
$query = array($this->getAttributeCode() => $item->getOptionId());
$item->setUrl($hlp->getFullUrl($query, true));
}
}
return $items;
}
示例10: ProcessRequest
public static function ProcessRequest()
{
if (isset($_REQUEST['component_params_manager']))
{
$reqId = intVal($_REQUEST['component_params_manager']);
$result = self::GetComponentProperties(
$_REQUEST['component_name'],
$_REQUEST['component_template'],
$_REQUEST['site_template'],
$_REQUEST['current_values']
);
$result['description'] = CComponentUtil::GetComponentDescr($_REQUEST['component_name']);
?>
<script>
window.__bxResult['<?php
echo $reqId;
?>
'] = <?php
echo CUtil::PhpToJSObject($result);
?>
;
</script>
<?
self::DisplayFileDialogsScripts();
}
}
示例11: cacheFilename
public function cacheFilename($format, $arg1 = null, $arg2 = null)
{
$folder = $this->ParentID ? $this->Parent()->Filename : ASSETS_DIR . "/";
$format = $format . $arg1 . $arg2;
$format .= $this->addWatermark ? '-wm' . intVal($this->getWatermarkPosition()) . intVal($this->getWatermarkTransparency()) : '';
return $folder . "_resampled/{$format}-" . $this->Name;
}
示例12: __MPF_ImageResizeHandler
function __MPF_ImageResizeHandler(&$arCustomFile, $arParams = null)
{
static $arResizeParams = array();
if ($arParams !== null) {
if (is_array($arParams) && array_key_exists("width", $arParams) && array_key_exists("height", $arParams)) {
$arResizeParams = $arParams;
} elseif (intVal($arParams) > 0) {
$arResizeParams = array("width" => intVal($arParams), "height" => intVal($arParams));
}
}
if (!is_array($arCustomFile) || !isset($arCustomFile['fileID'])) {
return false;
}
$fileID = $arCustomFile['fileID'];
$arFile = CFile::MakeFileArray($fileID);
if (CFile::CheckImageFile($arFile) === null) {
$aImgThumb = CFile::ResizeImageGet($fileID, array("width" => 90, "height" => 90), BX_RESIZE_IMAGE_EXACT, true);
$arCustomFile['img_thumb_src'] = $aImgThumb['src'];
if (!empty($arResizeParams)) {
$aImgSource = CFile::ResizeImageGet($fileID, array("width" => $arResizeParams["width"], "height" => $arResizeParams["height"]), BX_RESIZE_IMAGE_PROPORTIONAL, true);
$arCustomFile['img_source_src'] = $aImgSource['src'];
$arCustomFile['img_source_width'] = $aImgSource['width'];
$arCustomFile['img_source_height'] = $aImgSource['height'];
}
}
}
示例13: indexAction
function indexAction()
{
$this->setLayout('shares');
$id = intVal($this->getParam('id'));
$this->load->model('item');
$item = $this->item->get(array('id' => $id), true);
if (!$item) {
$this->forward404($id);
}
$this->frontend->addExtGroup('toolbar', $this->isIE());
$user_id = 0;
$ip = $_SERVER['REMOTE_ADDR'];
if ($this->auth->isLogged()) {
$this->setLayoutVar('logged_in', true);
$user = $this->auth->getUser();
$user_id = $user->id;
$this->load->model('viewed_post');
$newView = $this->viewed_post->addViewedPost($item->item_sid, $user_id, $ip);
if ($newView) {
$this->item->increaseItemViewed($id);
}
header('Location: ' . $item->link);
} else {
$this->setLayoutVar('logged_in', false);
}
$URLManager = new URLManager();
$og_metas = $URLManager->grabOGMeta($item->link);
$this->setLayoutVar('og_metas', $og_metas);
$this->setLayoutVar('item', $item);
}
示例14: Add
public static function Add($arFields)
{
global $DB;
if (!CForumUserPoints::CheckFields("ADD", $arFields)) {
return false;
}
$arInsert = $DB->PrepareInsert("b_forum_user_points", $arFields);
$strDatePostField = "";
$strDatePostValue = "";
if (!is_set($arFields, "DATE_UPDATE")) {
$strDatePostField .= ", DATE_UPDATE";
$strDatePostValue .= ", " . $DB->GetNowFunction() . "";
}
$strSql = "INSERT INTO b_forum_user_points(" . $arInsert[0] . $strDatePostField . ") VALUES(" . $arInsert[1] . $strDatePostValue . ")";
$DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
// Recount user points
if (intVal($arFields["TO_USER_ID"]) > 0) {
$arUserFields = array("POINTS" => CForumUser::CountUserPoints($arFields["TO_USER_ID"]));
$arUser = CForumUser::GetByUSER_ID($arFields["TO_USER_ID"]);
if ($arUser) {
CForumUser::Update(intVal($arUser["ID"]), $arUserFields);
} else {
$arUserFields["USER_ID"] = $arFields["TO_USER_ID"];
$ID_tmp = CForumUser::Add($arUserFields);
}
}
return true;
}
示例15: __main_post_form_image_resize
function __main_post_form_image_resize(&$arCustomFile, $arParams = null)
{
static $arResizeParams = array();
if ($arParams !== null) {
if (is_array($arParams) && array_key_exists("width", $arParams) && array_key_exists("height", $arParams)) {
$arResizeParams = $arParams;
} elseif (intVal($arParams) > 0) {
$arResizeParams = array("width" => intVal($arParams), "height" => intVal($arParams));
}
}
if (!is_array($arCustomFile) || !isset($arCustomFile['fileID'])) {
return false;
}
if (array_key_exists("ID", $arCustomFile)) {
$arFile = $arCustomFile;
$fileID = $arCustomFile['ID'];
} else {
$fileID = $arCustomFile['fileID'];
$arFile = CFile::MakeFileArray($fileID);
$arFile1 = CFile::GetByID($fileID)->fetch();
if (is_array($arFile) && is_array($arFile1)) {
$arCustomFile = array_merge($arFile, $arFile1, $arCustomFile);
}
}
if (CFile::CheckImageFile($arFile) === null) {
$aImgThumb = CFile::ResizeImageGet($fileID, array("width" => 90, "height" => 90), BX_RESIZE_IMAGE_EXACT, true);
$arCustomFile['img_thumb_src'] = $aImgThumb['src'];
if (!empty($arResizeParams)) {
$aImgSource = CFile::ResizeImageGet($fileID, array("width" => $arResizeParams["width"], "height" => $arResizeParams["height"]), BX_RESIZE_IMAGE_PROPORTIONAL, true);
$arCustomFile['img_source_src'] = $aImgSource['src'];
$arCustomFile['img_source_width'] = $aImgSource['width'];
$arCustomFile['img_source_height'] = $aImgSource['height'];
}
}
}