本文整理汇总了PHP中CController::createUrl方法的典型用法代码示例。如果您正苦于以下问题:PHP CController::createUrl方法的具体用法?PHP CController::createUrl怎么用?PHP CController::createUrl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CController
的用法示例。
在下文中一共展示了CController::createUrl方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createUrl
public function createUrl($route, $params = array(), $ampersand = '&')
{
if ($route[0] != '/' && !isset($params['rec']) && isset($this->actionParams['rec'])) {
$params['rec'] = $this->actionParams['rec'];
}
return parent::createUrl($route, $params, $ampersand);
}
示例2: actionRegistro
public function actionRegistro()
{
$modelAlumnos = new Alumno();
if (isset($_POST['Alumno'])) {
try {
$usuario = new Usuario();
$usuario->perfil = 3;
$usuario->nombreUsuario = $_POST['Alumno']['identificacion'];
$usuario->password = md5($_POST['Alumno']['identificacion']);
if ($usuario->save()) {
$alumno = new Alumno();
$alumno->attributes = $_POST['Alumno'];
$alumno->idUsuario = $usuario->idUsuario;
if (!$alumno->save()) {
Yii::app()->user->setFlash('alert alert-danger', "Alumno no fue creado");
} else {
Yii::app()->user->setFlash('alert alert-success', "Alumno fue creado con éxito");
$this->redirect(CController::createUrl('/sitio/index'));
}
} else {
Yii::app()->user->setFlash('alert alert-danger', "Alumno no fue creado");
}
} catch (Exception $e) {
Yii::app()->user->setFlash('alert alert-danger', "Alumno no fue creado");
}
}
$this->render('registroEstudiantes', array('modelAlumnos' => $modelAlumnos));
}
示例3: sendRequest
public function sendRequest($hole, $user)
{
if (!$hole->isMoscow) {
return false;
}
$client = $this->client;
Yii::app()->request->baseUrl = Yii::app()->request->hostInfo;
$pictures = array();
foreach ($hole->pictures_fresh as $pict) {
$pictures[] = array('name' => $pict->filename, 'fileType' => $pict->extension, 'content' => $pict->binary);
}
$answer = $client->RequestNew(array('request' => array('hidden' => false, 'informer' => array('name' => $this->name, 'surname' => $this->surname, 'fatherName' => $this->fatherName, 'phoneNumber' => $this->phoneNumber, 'email' => $this->email, 'notifyViaEmail' => $this->notifyViaEmail, 'notifyViaSms' => $this->notifyViaSms, 'address' => array('fullAddress' => $this->address)), 'category' => array('code' => $hole->type->dorogimos_id), 'details' => $this->details, 'address' => array('latitude' => $hole->LATITUDE, 'longitude' => $hole->LONGITUDE, 'fullAddress' => $this->holeAddress, 'webLink' => CController::createUrl('/holes/view', array('id' => $hole->ID))), 'pictures' => $pictures)));
if ($answer->successful) {
$holeRequest = new HoleRequests();
$holeRequest->hole_id = $hole->ID;
$holeRequest->user_id = $user->id;
$holeRequest->date_sent = time();
$holeRequest->response_requestid = $answer->request->requestNumber;
$holeRequest->type = 'dorogimos';
$holeRequest->gibdd_id = 0;
if ($holeRequest->save()) {
return true;
}
//else print_r($holeRequest->errors); die();
} else {
$this->errortext = $answer->failReason;
//print_r($answer); die();
}
return false;
}
示例4: createPageUrl
/**
* Creates the URL suitable for pagination.
* This method is mainly called by pagers when creating URLs used to
* perform pagination. The default implementation is to call
* the controller's createUrl method with the page information.
* You may override this method if your URL scheme is not the same as
* the one supported by the controller's createUrl method.
* @param CController $controller the controller that will create the actual URL
* @param integer $page the page that the URL should point to. This is a zero-based index.
* @return string the created URL
*/
public function createPageUrl($controller, $page)
{
$params = $this->params === null ? $_GET : $this->params;
if ($page > 0) {
// page 0 is the default
$params[$this->pageVar] = $page + 1;
} else {
unset($params[$this->pageVar]);
}
if ($controller->id == 'categories') {
$id = $params['id'];
unset($params['id']);
return $controller->createUrl($controller->route . '/id/' . $id, $params);
} else {
return $controller->createUrl($this->route, $params);
}
}
示例5: actionIndex
/**
* This is the default 'index' action that is invoked
* when an action is not explicitly requested by users.
*/
public function actionIndex()
{
if (Yii::app()->user->isGuest) {
$this->redirect(CController::createUrl('login'));
}
// renders the view file 'protected/views/site/index.php'
// using the default layout 'protected/views/layouts/main.php'
$this->render('index');
}
示例6: createUrl
/**
* @see CController::createUrl()
*/
public function createUrl($route, $params = array(), $ampersand = '&')
{
if (strlen($route) >= 0 && $route[0] == '#') {
if (($query = Yii::app()->getUrlManager()->createPathInfo($params, '=', $ampersand)) !== '') {
return $route . '?' . $query;
} else {
return $route;
}
} else {
return parent::createUrl($route, $params, $ampersand);
}
}
示例7: actionContact
/**
* Displays the contact page
*/
public function actionContact()
{
$model = CustomPage::LoadByRequestUrl('contact-us');
$this->pageTitle = $model->PageTitle;
$this->pageDescription = $model->meta_description;
$this->breadcrumbs = array($model->title => $model->RequestUrl);
$this->layout = "//layouts/column" . $model->column_template;
$ContactForm = new ContactForm();
if (isset($_POST['ContactForm'])) {
$ContactForm->attributes = $_POST['ContactForm'];
if ($ContactForm->validate()) {
$objEmail = new EmailQueue();
if (!Yii::app()->user->isGuest) {
$objCustomer = Customer::GetCurrent();
$objEmail->customer_id = $objCustomer->id;
$ContactForm->fromName = $objCustomer->mainname;
$ContactForm->fromEmail = $objCustomer->email;
}
$strHtmlBody = $this->renderPartial('/mail/_contactform', array('model' => $ContactForm), true);
$strSubject = Yii::t('email', 'Contact Us:') . $ContactForm->contactSubject;
$objEmail->htmlbody = $strHtmlBody;
$objEmail->subject = $strSubject;
$orderEmail = _xls_get_conf('ORDER_FROM', '');
$objEmail->to = empty($orderEmail) ? _xls_get_conf('EMAIL_FROM') : $orderEmail;
$objHtml = new HtmlToText();
//If we get back false, it means conversion failed which 99.9% of the time means improper HTML.
$strPlain = $objHtml->convert_html_to_text($strHtmlBody);
if ($strPlain !== false) {
$objEmail->plainbody = $strPlain;
}
if (!$objEmail->save()) {
Yii::log("Error creating email " . print_r($objEmail, true) . " " . print_r($objEmail->getErrors(), true), 'error', 'application.' . __CLASS__ . "." . __FUNCTION__);
}
Yii::app()->user->setFlash('success', Yii::t('email', 'Message sent. Thank you for contacting us. We will respond to you as soon as possible.'));
//Attempt to use an AJAX call to send the email. If it doesn't work, the Download process will catch it anyway.
$jsScript = "\$.ajax({url:\"" . CController::createUrl('site/sendemail', array("id" => $objEmail->id)) . "\"});";
Yii::app()->clientScript->registerScript('sendemail', $jsScript, CClientScript::POS_READY);
} else {
Yii::app()->user->setFlash('error', Yii::t('cart', 'Please check your form for errors.'));
if (YII_DEBUG) {
Yii::app()->user->setFlash('error', print_r($ContactForm->getErrors(), true));
}
}
}
if (!Yii::app()->user->isGuest) {
$objCustomer = Customer::GetCurrent();
$ContactForm->fromName = $objCustomer->mainname;
$ContactForm->fromEmail = $objCustomer->email;
}
$this->canonicalUrl = $model->canonicalUrl;
$this->render('contact', array('ContactForm' => $ContactForm, 'model' => $model));
}
示例8: editAttribute
/**
* @param $model - profile model
* @param $field - profile fields model item
* @param $params - htmlOptions
* @return string
*/
public function editAttribute($model, $field, $htmlOptions = array())
{
$list = array();
if ($this->params['emptyField']) {
$list[0] = $this->params['emptyField'];
}
$models = CActiveRecord::model($this->params['modelName'])->findAll();
foreach ($models as $m) {
$list[$m->getAttribute($m->tableSchema->primaryKey)] = $this->params['optionName'] ? $m->getAttribute($this->params['optionName']) : $m->getAttribute($m->tableSchema->primaryKey);
}
return CHtml::activeDropDownList($model, $field->varname, $list, $htmlOptions = array('ajax' => array('type' => 'POST', 'url' => CController::createUrl('/fm/fields/getDroDownDepValues'), 'data' => array('model' => $this->params['modelDestName'], 'field_dest' => $this->params['destField'], 'varname' => $field->VARNAME, $field->varname => 'js:this.value', 'optionDestName' => $this->params['optionDestName']), 'success' => 'function(data){
$("#ajax_loader").hide();
$("#Profile_' . $this->params['destField'] . '").html(data)
}', 'beforeSend' => 'function(){
$("#ajax_loader").fadeIn();
}')));
}
示例9: createUrl
/**
* @return string|void
*/
public function createUrl($route, $params = array(), $ampersand = '&')
{
if ($route == '/site/index') {
return '/index.php' . self::buildQuery($params);
} elseif ($route == '/wiki/view' && $params['pageName']) {
$pageName = $params['pageName'];
unset($params['pageName']);
return '/wiki/' . $pageName . self::buildQuery($params);
} elseif ($route == '/wiki/index') {
return '/list' . self::buildQuery($params);
} elseif ($route == '/site/page' && $params['view']) {
return '/page/' . $params['view'];
} elseif ($route == '/wiki/search') {
return '/search' . self::buildQuery($params);
}
return parent::createUrl($route, $params, $ampersand);
}
示例10: createUrl
/**
* @param string $route
* @param array $params
* @param string $ampersand
* @return string
*/
public function createUrl($route, $params = array(), $ampersand = '&')
{
$p = explode("/", $route);
if ($p[0] != "infos") {
if (!isset($params["veranstaltung_id"]) && $this->veranstaltung !== null) {
$params["veranstaltung_id"] = $this->veranstaltung->url_verzeichnis;
}
if (MULTISITE_MODE && !isset($params["veranstaltungsreihe_id"]) && $this->veranstaltungsreihe != null) {
$params["veranstaltungsreihe_id"] = $this->veranstaltungsreihe->subdomain;
}
if ($route == "veranstaltung/index" && !is_null($this->veranstaltungsreihe) && strtolower($params["veranstaltung_id"]) == strtolower($this->veranstaltungsreihe->aktuelle_veranstaltung->url_verzeichnis)) {
unset($params["veranstaltung_id"]);
}
if (in_array($route, array("veranstaltung/ajaxEmailIstRegistriert", "veranstaltung/anmeldungBestaetigen", "veranstaltung/benachrichtigungen", "veranstaltung/impressum", "veranstaltung/login", "veranstaltung/logout", "/admin/index/reiheAdmins", "/admin/index/reiheVeranstaltungen"))) {
unset($params["veranstaltung_id"]);
}
}
return parent::createUrl($route, $params, $ampersand);
}
示例11: actionFilaProducto
/**
* Displays a particular model.
* @param integer $id the ID of the model to be displayed
*/
public function actionFilaProducto()
{
$model = new FacturasProductos();
//echo '<tr>';
$form = $this->beginWidget('booster.widgets.TbActiveForm', array('id' => 'facturas-productos-fila', 'enableAjaxValidation' => false));
//echo '<div id="retorno">';
echo '<td>';
echo '<div class="form-group">';
$list = CHtml::listData(PresupuestoPartidas::model()->findAllByAttributes(array('ente_organo_id' => Usuarios::model()->findByPk(Yii::app()->user->getId())->enteOrgano->ente_organo_id, 'anho' => Yii::app()->params['trimestresFechas'][Yii::app()->session['trimestreSeleccionado']]['anho'])), 'partida_id', function ($presuPartida) {
return $presuPartida->partida->etiquetaPartida();
});
echo CHtml::label('Seleccionar partida', 'partida');
echo "<br>";
$this->widget('booster.widgets.TbSelect2', array('asDropDownList' => true, 'model' => $model, 'attribute' => 'presupuesto_partida_id', 'data' => $list, 'htmlOptions' => array('id' => 'partida', 'ajax' => array('type' => 'POST', 'url' => CController::createUrl('facturasProductos/buscarProductosPartida'), 'update' => '#producto')), 'options' => array('placeholder' => 'Partida', 'width' => '40%', 'tokenSeparators' => array(',', ' '))));
echo '</div>';
echo '</td>';
echo '<td>';
echo '<div class="form-group">';
echo CHtml::label('Seleccionar producto', 'producto');
echo "<br>";
$this->widget('booster.widgets.TbSelect2', array('asDropDownList' => true, 'model' => $model, 'attribute' => 'producto_id', 'data' => array(), 'htmlOptions' => array('id' => 'producto'), 'options' => array('placeholder' => 'Producto', 'width' => '40%', 'tokenSeparators' => array(',', ' '))));
echo '</div>';
echo '</td>';
echo '<td>';
echo $form->textFieldGroup($model, 'costo_unitario', array('widgetOptions' => array('htmlOptions' => array('class' => 'span5', 'maxlength' => 38))));
echo '</td>';
echo '<td>';
echo $form->textFieldGroup($model, 'cantidad_adquirida', array('widgetOptions' => array('htmlOptions' => array('class' => 'span5'))));
echo '</td>';
echo '<td>';
$list = CHtml::listData(Iva::model()->findAll(), 'id', 'porcentaje');
echo $form->dropDownListGroup($model, 'iva_id', array('wrapperHtmlOptions' => array('class' => 'col-sm-5'), 'widgetOptions' => array('data' => $list, 'htmlOptions' => array())));
echo '</td>';
echo '</div>';
$this->endWidget();
//echo '</tr>';
}
示例12: array
?>
<span class="status"> </span>
<?php
echo $form->error($address, 'student_address_p_country');
?>
</div>
<div class="row-left">
<?php
echo $form->labelEx($address, 'student_address_p_state');
?>
<?php
if (isset($address->student_address_p_state)) {
echo $form->dropDownList($address, 'student_address_p_state', CHtml::listData(State::model()->findAll(array('condition' => 'country_id=' . $address->student_address_p_country)), 'state_id', 'state_name'), array('prompt' => '-----------Select-----------', 'tabindex' => 10, 'ajax' => array('type' => 'POST', 'url' => CController::createUrl('dependent/UpdateStudPCities'), 'update' => '#StudentAddress_student_address_p_city')));
} else {
echo $form->dropDownList($address, 'student_address_p_state', array(), array('prompt' => '-----------Select-----------', 'tabindex' => 10, 'ajax' => array('type' => 'POST', 'url' => CController::createUrl('dependent/UpdateStudPCities'), 'update' => '#StudentAddress_student_address_p_city')));
}
?>
<span class="status"> </span>
<?php
echo $form->error($address, 'student_address_p_state');
?>
</div>
</div>
<div class="row">
<div class="row-left">
<?php
echo $form->labelEx($address, 'student_address_p_city');
示例13: array
src="<?php
echo Yii::app()->request->baseUrl . '/js_plugins/ajaxform/images/icons/cross_grey_small.png';
?>
"
title="Close this notification" alt="close"/></a>
<div>
<?php
echo $val_error_msg;
?>
</div>
</div>
<div id="ajax-form" class='form'>
<?php
$formId = 'contact-groups-form';
$actionUrl = $model->isNewRecord ? CController::createUrl('contactgroups/ajax_create') : CController::createUrl('contactgroups/ajax_update');
$form = $this->beginWidget('CActiveForm', array('id' => 'contact-groups-form', 'action' => $actionUrl, 'enableClientValidation' => true, 'focus' => array($model, 'name'), 'errorMessageCssClass' => 'input-notification-error error-simple png_bg', 'clientOptions' => array('validateOnSubmit' => true, 'validateOnType' => false, 'afterValidate' => 'js_afterValidate', 'errorCssClass' => 'err', 'successCssClass' => 'suc', 'afterValidate' => 'js:function(form,data,hasError){ $.js_afterValidate(form,data,hasError); }', 'errorCssClass' => 'err', 'successCssClass' => 'suc', 'success' => 'function(){alert(1);}', 'afterValidateAttribute' => 'js:function(form, attribute, data, hasError){
$.js_afterValidateAttribute(form, attribute, data, hasError);
}')));
?>
<?php
echo $form->errorSummary($model, '
<div style="font-weight:bold">Please correct these errors:</div>
', NULL, array('class' => 'errorsum notification errorshow png_bg'));
?>
<p class="note">Fields with <span class="required">*</span> are required.</p>
<div class="row">
<?php
echo $form->labelEx($model, 'group_name');
示例14: array
<?php
$pl_details = $plans_list = array();
$sql = "SELECT * FROM {{view_panel_list_master}} WHERE panel_list_id = '" . $_SESSION['plid'] . "'";
$pl_details = Yii::app()->db->createCommand($sql)->query()->readAll();
$sql = "SELECT * FROM {{panellist_answer}} WHERE panellist_id = '" . $_SESSION['plid'] . "'";
$pl_answer = Yii::app()->db->createCommand($sql)->query()->readAll();
foreach ($pl_answer as $key => $value) {
foreach ($value as $ky => $val) {
$plans_list[$ky] = $val;
}
}
if (count($pl_answer) > 0) {
?>
<div style="float:right;">
<a href="<?php
echo CController::createUrl('pl/home/sa/edit_profile');
?>
" class="nav-cta login">
<input type="button" value="Edit Profile">
</a>
<!-- <a href="security_question" class="nav-cta login">Security Questions</span></a>-->
</div>
<section class="container w90_per">
<div class="box w98_per effect7">
<h3>Registration Information</h3>
<p>
<table class="InfoForm" style="width: 95%; margin: 0px auto;">
<tr class="even">
<td>Email Address</td>
<td><?php
示例15: array
<?php
$form = $this->beginWidget('CActiveForm', array('id' => 'lugares-form', 'enableAjaxValidation' => false));
?>
<div class="row">
<?php
echo $form->labelEx($model, 'n_direc');
if (!$model->isNewRecord) {
$criterial = new CDbCriteria();
$criterial->condition = 'c_hcod=:prove';
$criterial->params = array(':prove' => $model->codpro);
$datos = CHtml::listData(Direcciones::model()->findAll($criterial), 'n_direc', 'c_direc');
}
echo $form->dropDownList($model, 'n_direc', $model->isNewRecord ? array() : $datos, array('ajax' => array('type' => 'POST', 'url' => CController::createUrl('Lugares/Verlugares'), 'update' => '#primo'), 'prompt' => 'Seleccione una organizacion', 'disabled' => $model->isNewRecord ? '' : 'disabled'));
?>
</div>
<div id="primo" style ="width:250px">
</div>
<div class="row">
<?php
echo $form->labelEx($model, 'deslugar');
?>
<?php
echo $form->textField($model, 'deslugar', array('size' => 30, 'maxlength' => 30));
?>
<?php
echo $form->error($model, 'deslugar');
?>
</div>