本文整理汇总了PHP中param函数的典型用法代码示例。如果您正苦于以下问题:PHP param函数的具体用法?PHP param怎么用?PHP param使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了param函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: buildLinks
public function buildLinks()
{
$links = array();
$dataPath = Utils::dataViewPath('navigations');
$menuItems = (include $dataPath . '/sub.php');
$c = app()->controller->id;
foreach ($menuItems as $itemInfo) {
if (is_array($itemInfo[1])) {
$firstController = '';
foreach ($itemInfo[1] as $cId => $title) {
if (empty($firstController)) {
$firstController = $cId;
}
if ($c == $cId) {
$links[t($itemInfo[0])] = url($firstController);
$links[t($title)] = url(param('adminUrl') . $cId);
break;
}
}
} else {
if ($c == $itemInfo) {
$links[t($itemInfo[1])] = url(param('adminUrl') . $c);
break;
}
}
}
$links[] = $this->getLastTitle();
return $links;
}
示例2: search
public function search()
{
$criteria = new CDbCriteria();
$criteria->order = 'id DESC';
$criteria->compare('apartment_id', $this->apartment_id, true);
return new CActiveDataProvider($this, array('criteria' => $criteria, 'pagination' => array('pageSize' => param('adminPaginationPageSize', 20))));
}
示例3: standardizeData
private function standardizeData($data)
{
$result = array();
if (is_array($data) && !empty($data)) {
$i = 0;
$model = str_replace('_', ' ', app()->controller->getModel(null)->tableName());
foreach ($data as $item) {
// Title
if (!isset($item['title'])) {
$item['title'] = ucfirst($item['action']);
}
// Confirm message
if (!isset($item['confirm'])) {
$action = strtolower($item['title']);
$item['confirm'] = str_replace(array('{action}', '{model}'), array($action, $model), $this->confirmMsg);
}
// Url
if (!isset($item['params'])) {
$item['params'] = array();
}
$item['url'] = url(param('adminUrl') . app()->controller->id . '/bulk' . ucfirst($item['action']), $item['params']);
$result[$i]['label'] = t($item['title']);
$result[$i]['url'] = '#';
$result[$i]['linkOptions']['bulkUrl'] = $item['url'];
if (isset($item['confirm'])) {
$result[$i]['linkOptions']['confirmMsg'] = $item['confirm'];
}
$i++;
}
}
return $result;
}
示例4: actionSaveSort
public function actionSaveSort()
{
$objTypeId = Yii::app()->request->getParam('id', NULL);
$sort = Yii::app()->request->getParam('sort');
if (count($sort) >= param('searchMaxField', 15)) {
HAjax::jsonError(tt('Search max field ') . param('searchMaxField', 3));
}
if ($objTypeId !== NULL && $sort && is_array($sort)) {
$elements = SearchForm::getSearchFields();
$sql = "DELETE FROM {{search_form}} WHERE obj_type_id=:id AND status!=:status";
Yii::app()->db->createCommand($sql)->execute(array(':id' => $objTypeId, ':status' => SearchFormModel::STATUS_NOT_REMOVE));
$i = 3;
foreach ($sort as $field) {
if (!isset($elements[$field])) {
continue;
}
$search = new SearchFormModel();
$search->attributes = array('obj_type_id' => $objTypeId, 'field' => $field, 'status' => $elements[$field]['status'], 'sorter' => $i, 'formdesigner_id' => isset($elements[$field]['formdesigner_id']) ? $elements[$field]['formdesigner_id'] : 0);
$search->save();
$i++;
}
// delete assets js cache
ConfigurationModel::clearGenerateJSAssets();
HAjax::jsonOk();
}
HAjax::jsonError();
}
示例5: settings
function settings($action)
{
global $_out, $_struct;
if (($xml = $this->getDataXML()) && ($e = $xml->getElementById('settings'))) {
$form = new form($e);
$form->replaceURI(array('MODULE' => $this->getId(), 'SECTION' => $this->getSection()->getId(), 'PATH_DATA_FILE_CLIENT' => ABS_PATH_DATA_CLIENT . ap::id($this->getSection()->getId()) . '.xml', 'PATH_DATA_FILE_AP' => ABS_PATH_DATA_AP . ap::id($this->getSection()->getId()) . '.xml'));
if ($ff = $form->getField('section')) {
apSectionEdit::seclist(ap::getClientstructure()->de(), $ff, $ar = array());
}
switch ($action) {
case 'update':
case 'apply_update':
$form->save($_REQUEST);
break;
case 'edit':
if (($id = param('section')) && ($sec = $_struct->getSection($id)) && ($modules = $sec->getModules())) {
$xml = new xml(null, 'modules', false);
foreach ($modules as $m) {
$xml->de()->appendChild($xml->importNode($m->getRootElement(), false));
}
ap::ajaxResponse($xml);
}
break;
}
$form->load();
$_out->addSectionContent($form->getRootElement());
$this->addTemplate('tpl.xsl');
}
}
示例6: page
/**
* Returns the current page number
*
* @return int
*/
public function page()
{
if (!is_null($this->page)) {
return $this->page;
}
if ($this->options['page']) {
$this->page = $this->options['page'];
} else {
$this->page = $this->options['method'] == 'query' ? get($this->options['variable']) : param($this->options['variable']);
}
// make sure the page is an int
$this->page = intval($this->page);
// set the first page correctly
if ($this->page == 0) {
$this->page = 1;
}
// sanitize the page if too low
if ($this->page < 1) {
$this->redirect();
$this->page = 1;
}
// sanitize the page if too high
if ($this->page > $this->pages && $this->count > 0) {
$this->redirect();
$this->page = $this->lastPage();
}
// return the sanitized page number
return $this->page;
}
示例7: tagcloud
/**
* Tagcloud plugin
*
* @author Bastian Allgeier <bastian@getkirby.com>
* @version 2.0.0
*/
function tagcloud($parent, $options = array())
{
// default values
$defaults = array('limit' => false, 'field' => 'tags', 'children' => 'visible', 'baseurl' => $parent->url(), 'param' => 'tag', 'sort' => 'results', 'sortdir' => 'desc');
// merge defaults and options
$options = array_merge($defaults, $options);
switch ($options['children']) {
case 'invisible':
$children = $parent->children()->invisible();
break;
case 'visible':
$children = $parent->children()->visible();
break;
default:
$children = $parent->children();
break;
}
$tags = $children->pluck($options['field'], ',');
$tags = array_count_values($tags);
$cloud = array();
$ds = DS == '/' ? ':' : ';';
foreach ($tags as $tag => $count) {
$cloud[$tag] = new Obj(array('results' => $count, 'name' => $tag, 'url' => $options['baseurl'] . '/' . $options['param'] . $ds . urlencode($tag), 'isActive' => urldecode(param($options['param'])) == $tag));
}
$cloud = new Collection($cloud);
$cloud = $cloud->sortBy($options['sort'], $options['sortdir']);
if ($options['limit']) {
$cloud = $cloud->limit($options['limit']);
}
return $cloud;
}
示例8: search
public function search()
{
$criteria = new CDbCriteria();
$criteria->compare('page', $this->page, true);
$criteria->compare('is_offline', $this->is_offline, true);
return new CActiveDataProvider($this, array('criteria' => $criteria, 'sort' => array('defaultOrder' => 'date_created DESC'), 'pagination' => array('pageSize' => param('adminPaginationPageSize', 20))));
}
示例9: reserv_permit
function reserv_permit($ruid, $euid, $confirm)
{
global $xoopsUser, $xoopsModule, $isadmin, $xoopsModuleConfig;
if (!is_object($xoopsUser)) {
if ($confirm == param('key')) {
return true;
}
if ($xoopsModuleConfig['member_only'] == ACCEPT_MEMBER) {
return false;
}
return true;
}
// administrator has permit
if ($isadmin) {
return true;
}
$uid = $xoopsUser->getVar('uid');
// reservation person
if ($uid == $ruid && $confirm == param('key')) {
return true;
}
// event poster
if ($uid == $euid) {
return true;
}
return false;
}
示例10: actionIndex
public function actionIndex($tab = null)
{
$allUsers = $pages = null;
$itemsProvider = new CArrayDataProvider(array());
$this->setActiveMenu('my_mailbox');
$return = Messages::getAllContactUsers(Yii::app()->user->id);
if ($return) {
$allUsers = $return['allUsers'];
$pages = $return['pages'];
if (count($allUsers)) {
$itemsProvider = new CArrayDataProvider($allUsers, array('pagination' => array('pageSize' => param('userPaginationPageSize', 20))));
}
}
switch ($tab) {
case "inbox":
$messages = Messages::model()->findAll('id_userTo=:toUser AND is_deleted<>:isDeleted', [':toUser' => Yii::app()->user->id, ':isDeleted' => Messages::MESSAGE_ACTIVE]);
break;
case "outbox":
$messages = Messages::model()->findAll('id_userFrom=:fromUser AND is_deleted<>:isDeleted', [':fromUser' => Yii::app()->user->id, ':isDeleted' => Messages::MESSAGE_ACTIVE]);
break;
case "admin":
$sql = "select * from bt_messages WHERE is_deleted<>" . Messages::MESSAGE_ACTIVE . "\n AND EXISTS(select null FROM bt_users WHERE id=id_userFrom\n AND role IN('admin','moderator'))";
$messages = Messages::model()->findBySql($sql);
break;
default:
$messages = Messages::model()->findAll('id_userTo=:toUser AND is_deleted<>:isDeleted', [':toUser' => Yii::app()->user->id, ':isDeleted' => Messages::MESSAGE_ACTIVE]);
break;
}
$this->render('index', array('allUsers' => $allUsers, 'pages' => $pages, 'itemsProvider' => $itemsProvider, 'messages' => $messages));
}
示例11: body
protected function body()
{
echo '<div class="error-wrapper">';
echo '<h1>We have an error!!</h1>';
echo '<h2>The error is: ' . param('error') . '</h2>';
echo '</div>';
}
示例12: b_wp_calendar_show
function b_wp_calendar_show($option, $wp_num = "")
{
global $wpdb, $siteurl, $wp_id, $wp_inblock, $xoopsConfig, $use_cache, $m, $monthnum, $year, $wp_mod, $wp_base;
$id = 1;
$use_cache = 1;
if ($wp_num == "") {
$wp_id = $wp_num;
$wp_inblock = 1;
include dirname(__FILE__) . '/../wp-config.php';
$wp_inblock = 0;
}
if (current_wp()) {
param('m', 'integer', '');
param('monthnum', 'integer', '');
param('year', 'integer', '');
$m = array_key_exists('m', $_GET) ? $_GET['m'] : '';
$monthnum = array_key_exists('monthnum', $_GET) ? $_GET['monthnum'] : '';
$year = array_key_exists('year', $_GET) ? $_GET['year'] : '';
}
ob_start();
block_style_get($wp_num);
get_calendar(1);
$block['content'] = ob_get_contents();
ob_end_clean();
return $block;
}
示例13: run
function run()
{
global $_out, $_sec;
if (ap::isCurrentModule($this)) {
ap::addMessage($this->getMessage());
if ($form = $this->getForm()) {
$form->replaceURI(array('ID' => $_sec->getId(), 'MD' => $this->getId(), 'PARENT' => $this->getSection()->GetParent()->getId()));
switch ($action = param('action')) {
case 'save':
$values = $this->initImages($form, true);
$values = array_merge($_REQUEST, $values);
$form->save($values);
$this->updateImagesSize($form);
$this->redirect('save_ok');
break;
case 'fileinfo':
if (($path = urldecode(param('path'))) && ($f = ap::getFileInfo($_SERVER['DOCUMENT_ROOT'] . $path))) {
$f['path'] = $path;
$xml = new xml(null, 'file', false);
foreach ($f as $tagName => $value) {
$xml->de()->appendChild($xml->createElement($tagName, null, $value));
}
ap::ajaxResponse($xml);
}
vdump('Error file not found ' . $path);
break;
}
$this->initImages($form, false);
$form->load();
$_out->elementIncludeTo($form->getRootElement(), '/page/section');
} else {
throw new Exception('Form not found', EXCEPTION_XML);
}
}
}
示例14: search
public function search()
{
$criteria = new CDbCriteria();
$tmp = 'title_' . Yii::app()->language;
$criteria->compare('id', $this->id);
$criteria->compare($tmp, $this->{$tmp}, true);
if (issetModule('location') && param('useLocation', 1)) {
$criteria->compare('loc_country', $this->loc_country);
$criteria->compare('loc_region', $this->loc_region);
$criteria->compare('loc_city', $this->loc_city);
} else {
$criteria->compare('city_id', $this->city_id);
}
$criteria->addCondition('owner_id = ' . Yii::app()->user->id);
if ($this->active === '0' || $this->active) {
$criteria->addCondition('active = :active');
$criteria->params[':active'] = $this->active;
}
if ($this->owner_active === '0' || $this->owner_active) {
$criteria->addCondition('owner_active = :active');
$criteria->params[':active'] = $this->owner_active;
}
if ($this->type) {
$criteria->addCondition('type = :type');
$criteria->params[':type'] = $this->type;
}
if ($this->obj_type_id) {
$criteria->addCondition('obj_type_id = :obj_type_id');
$criteria->params[':obj_type_id'] = $this->obj_type_id;
}
$criteria->addCondition('active <> :draft');
$criteria->params['draft'] = Apartment::STATUS_DRAFT;
$criteria->addInCondition('type', self::availableApTypesIds());
return new CActiveDataProvider($this, array('criteria' => $criteria, 'sort' => array('defaultOrder' => 'id DESC'), 'pagination' => array('pageSize' => param('userPaginationPageSize', 20))));
}
示例15: onValidateId
protected function onValidateId()
{
$id = param("id");
if (!hasPerm(AUTH_MGR) || is_null(param("id"))) {
setParam("id", $_SESSION["empId"]);
}
}