本文整理汇总了PHP中CVarDumper::dumpAsString方法的典型用法代码示例。如果您正苦于以下问题:PHP CVarDumper::dumpAsString方法的具体用法?PHP CVarDumper::dumpAsString怎么用?PHP CVarDumper::dumpAsString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CVarDumper
的用法示例。
在下文中一共展示了CVarDumper::dumpAsString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
public function run($isTab = false)
{
/** @var TourBuilderForm $tourForm */
$tourForm = Yii::app()->user->getState('tourForm');
$eventId = $tourForm->eventId;
$startCities = Yii::app()->user->getState('startCities');
$currentStartCityIndex = Yii::app()->user->getState('startCitiesIndex') - 1;
$currentStartCity = City::model()->findByPk($startCities[$currentStartCityIndex]->id);
$startCityId = $currentStartCity->id;
$event = Event::model()->findByPk($eventId);
$tripStorage = new TripStorage();
$order = $tripStorage->saveOrder($event, $startCityId, 'Тур для события "' . $event->title . '" из ' . $currentStartCity->caseGen);
$eventOrder = new EventOrder();
$eventOrder->startCityId = $startCityId;
$eventOrder->orderId = $order->id;
$eventOrder->eventId = $event->id;
$eventOrder->save();
$eventPrice = EventPrice::model()->findByAttributes(array('eventId' => $eventId, 'cityId' => $startCityId));
if (!$eventPrice) {
$eventPrice = new EventPrice();
}
$eventPrice->eventId = $event->id;
$eventPrice->cityId = $startCityId;
$eventPrice->bestPrice = $tripStorage->getPrice();
if (!$eventPrice->save()) {
throw new CHttpException('Could not save price for event - city.' . CVarDumper::dumpAsString($eventPrice));
}
$this->controller->redirect($this->controller->createUrl('showEventTrip'));
}
示例2: actionReadTopic
public function actionReadTopic($id)
{
$thread = Thread::model()->getThreadInfoById($id);
$this->areaLarge = $thread['program_name'];
$this->areaSmall = $thread['semester_name'];
$reply = new Reply();
$complaint = new Complaint('postComplaint');
if (isset($_POST['Reply'])) {
$reply->attributes = $_POST['Reply'];
$reply->post_item_id = $id;
if ($reply->save()) {
Yii::app()->user->setFlash('success', Yii::t('forum', 'forum.view.reply.success'));
$reply->unsetAttributes();
} else {
Yii::app()->user->setFlash('error', Yii::t('forum', 'forum.view.reply.error'));
}
}
if (isset($_POST['Complaint'])) {
$complaint->attributes = $_POST['Complaint'];
if ($complaint->save()) {
if ($complaint->post_item_id == $id) {
Yii::app()->user->setFlash('success', Yii::t('forum', 'forum.view.complaint.success'));
} else {
Yii::app()->user->setFlash('success', Yii::t('forum', 'forum.view.complaint.success'));
}
$complaint->unsetAttributes();
} else {
Yii::app()->clientScript->registerScript('show_modal', "\$('#reportModal').modal('show');", CClientScript::POS_READY);
}
}
$dataProvider = Thread::model()->getPostsDataInThread($id);
Yii::log(CVarDumper::dumpAsString($dataProvider->getData()));
$this->render('application.modules.community.views.front.post.view', array('thread' => $thread, 'threadId' => $id, 'dataProvider' => $dataProvider, 'reply' => $reply, 'complaint' => $complaint));
}
示例3: run
public function run()
{
$nav = $content = '';
$first = true;
$type = rtrim($this->type, 's');
foreach ($this->items as $id => $item) {
if (is_array($item['content'])) {
$id = "{$this->id}-{$id}";
$opts = $first ? array('class' => 'active') : array();
$opts['class'] = isset($opts['class']) ? $opts['class'] . ' dropdown' : 'dropdown';
$dropdown = array();
foreach ($item['content'] as $subId => $subTab) {
Yii::trace(CVarDumper::dumpAsString($subTab));
$subOpts = array();
$subOpts['id'] = "{$id}-{$subId}";
$subOpts['class'] = 'tab-pane';
$content .= CHtml::tag('div', $subOpts, $subTab['content']);
$dropdown[$subTab['title']] = '#' . $subOpts['id'];
}
Yii::trace(CVarDumper::dumpAsString($dropdown));
$nav .= CHtml::tag('li', $opts, BHtml::dropdownToggle($item['title']) . BHtml::dropdownMenu($dropdown, array('linkOptions' => array('data-toggle' => 'tab'))));
} else {
$id = "{$this->id}-{$id}";
$opts = $first ? array('class' => 'active') : array();
$nav .= CHtml::tag('li', $opts, CHtml::link($item['title'], "#{$id}", array('data-toggle' => $type)));
$opts['id'] = $id;
$opts['class'] = isset($opts['class']) ? $opts['class'] . ' tab-pane' : 'tab-pane';
$content .= CHtml::tag('div', $opts, $item['content']);
}
$first = false;
}
echo CHtml::tag('div', $this->htmlOptions, CHtml::tag('ul', $this->navOptions, $nav) . CHtml::tag('div', array('class' => 'tab-content'), $content));
BHtml::registerBootstrapJs();
}
示例4: actionAdd
public function actionAdd()
{
$model = new Umbrella();
if (isset($_POST['Umbrella'])) {
$model->attributes = $_POST;
$model->umbrellaid = uniqid('', true);
$model->attributes = $_POST['Umbrella'];
$model->create_userid = $this->user_id;
$model->now_userid = $this->user_id;
$model->create_at = $this->getTime();
if (SERVER_TEST) {
$model->img = "http://umbrella.b0.upaiyun.com/991c/991c1b1f34d6d076bcf7e01925af1e43/7GTMyFS_QW00m6fdAzzdphLPJtGAvlF9Gd4ivkWNQ9-olR2mFgn6NBn8JW8e78H2.jpg";
}
// $model->status=UMBRELLASTATUS::IDLE;
if ($model->validate()) {
$model->img = $this->updateWxImage($model->img);
if (!$model->save()) {
Yii::log(CVarDumper::dumpAsString($user->errors), 'error', "Add umbrella save error");
}
$this->actionInfo($model->umbrellaid);
return;
}
}
$this->render('add', array('model' => $model, 'status' => 'new'));
}
示例5: findTree
/**
* @param array $options options for tree searching. Valid options are:
* exclude: array list of children exclusions
* level: integer, recursion depth, default=-1
* Level -1 means searching for all children under root;
* Level 0 means searching for only the child DIRECTLY under the root;
* level N means searching for those children that are within N levels.
*/
public function findTree($options = array())
{
$exclude = array();
$level = -1;
extract($options);
$cache = $this->getCache();
$cacheKey = get_class($this->getOwner()) . '-' . $this->getOwner()->{$this->primaryKey} . '-' . $this->className . '-' . $this->primaryKey . '-' . $this->attributeName . '-' . CVarDumper::dumpAsString($this->attributes) . '-' . CVarDumper::dumpAsString($this->criteria) . '-' . CVarDumper::dumpAsString($exclude) . '-' . CVarDumper::dumpAsString($level);
$cacheKey = md5($cacheKey);
if (isset($cache) && ($data = $cache->get($cacheKey)) !== false) {
Yii::trace('Find tree from cache:' . $cacheKey, 'Xpress.extensions.web.behaviors');
return $data;
}
$event = new NestedEvent($this);
$event->params = array('exclude' => $exclude, 'level' => $level);
if ($this->hasEventHandler('onBeforeFindTree')) {
$this->onBeforeFindTree($event);
}
$tree = $this->findTreeRecursive($exclude, 0, NULL, $level);
$event->data =& $tree;
if ($this->hasEventHandler('onAfterFindTree')) {
$this->onAfterFindTree($event);
}
if (isset($cache)) {
$cache->set($cacheKey, $tree);
}
Yii::trace('Find tree from database', 'Xpress.extensions.web.behaviors');
return $tree;
}
示例6: actionUpdate
/**
* Updates a particular model.
* If update is successful, the browser will be redirected to the 'view' page.
* @param integer $id the ID of the model to be updated
*/
public function actionUpdate($id)
{
/* @param Slide $model*/
$model = $this->loadModel($id);
$maxPositions = Slide::model()->count();
Yii::log("PrevImage: " . $model->slide_image, 'log');
if (isset($_POST['Slide'])) {
$model->oldPosition = $model->position;
$model->attributes = $_POST['Slide'];
Yii::log("CurrImage: " . $model->slide_image, 'log');
$fileUpload = CUploadedFile::getInstance($model, 'slide_image');
Yii::log("FileUpload: " . CVarDumper::dumpAsString($fileUpload), 'log');
if ($fileUpload !== null) {
$model->removeImage();
$model->slide_image = $fileUpload;
}
if ($model->validate() && $model->save()) {
if ($fileUpload !== null) {
$model->slide_image->saveAs(Yii::app()->basePath . '/../files/images/slides/' . $model->slide_image . "_" . $model->getPrimaryKey());
}
$this->redirect(array('view', 'id' => $model->slide_id));
}
}
$viewablePositions = array();
foreach (range(0, $maxPositions - 1) as $position) {
$viewablePositions[$position] = Formatter::formatOrdinal($position + 1);
}
$this->positions = $viewablePositions;
$this->render('update', array('model' => $model));
}
示例7: actionUpdate
/**
* Updates a particular model.
* If update is successful, the browser will be redirected to the 'view' page.
* @param integer $id the ID of the model to be updated
*/
public function actionUpdate($id)
{
$model = new WorkshopForm('view', $id);
// Uncomment the following line if AJAX validation is needed
// $this->performAjaxValidation($model);
if (isset($_POST['WorkshopForm'])) {
$model->attributes = $_POST['WorkshopForm'];
$model->postItem->attributes = $_POST['PostItem'];
$model->workshop->attributes = $_POST['Workshop'];
$model->workshopFile = CUploadedFile::getInstance($model, 'workshopFile');
Yii::log(CVarDumper::dumpAsString($model->workshopFile));
if ($model->validate()) {
$fileUpload = $model->workshopFile;
if ($fileUpload !== null) {
$model->workshop->removeFile();
$model->workshop->workshop_file = $fileUpload;
$fileName = $fileUpload->name;
}
if ($model->save()) {
if ($model->workshop->workshop_file !== null) {
$userFilePath = FileHelper::getFilePath(Yii::getPathOfAlias('site.files') . '/workshops/' . $model->postItem->primaryKey . '/');
$model->workshopFile->saveAs($userFilePath . $fileName);
}
$this->redirect(array('view', 'id' => $model->workshop->post_item_id));
}
}
}
$this->render('update', array('model' => $model));
}
示例8: createOrUpdate
public static function createOrUpdate($id, $title, $address, $latitude, $longitude, $type = 'create')
{
$querystring_arrays = array();
$uri = '';
if ($type == 'create') {
//这里是创建
$uri = '/geodata/v3/poi/create';
$querystring_arrays = array('id' => $id, 'title' => $title, 'latitude' => $latitude, 'longitude' => $longitude, 'coord_type' => 1, 'geotable_id' => GEOTABLE_ID, 'ak' => MAP_AK);
} else {
//这里是更新
$uri = '/geodata/v3/poi/update';
$querystring_arrays = array('id' => $id, 'title' => $title, 'latitude' => $latitude, 'longitude' => $longitude, 'coord_type' => 1, 'geotable_id' => GEOTABLE_ID, 'ak' => MAP_AK);
}
$sn = BDLbs::caculateAKSN($uri, $querystring_arrays, "POST");
$querystring_arrays['sn'] = $sn;
Yii::trace(CVarDumper::dumpAsString($querystring_arrays), 'create or update baidu poi post');
$ret = Yii::app()->curl->post(Yii::app()->params['baiduapi'] . $uri, $querystring_arrays);
$ret = json_decode($ret, true);
Yii::trace(CVarDumper::dumpAsString($ret), 'create or update baidu poi');
if ($ret['status'] == 0) {
return $ret['id'];
} else {
Yii::log(CVarDumper::dumpAsString($ret), 'error', 'create or update baidu poi ERROR');
return -1;
}
}
示例9: injectForBe
public static function injectForBe($flightVoyages, $injectSearchParams = false)
{
$newFlights = array();
try {
if (!is_iterable($flightVoyages)) {
throw new CException('Flight Voyages are not iterable.');
}
foreach ($flightVoyages as $key => $flight) {
$newFlight = $flight;
if ($injectSearchParams) {
$newFlight['serviceClass'] = $injectSearchParams['serviceClass'];
$newFlight['freeWeight'] = $newFlight['serviceClass'] == 'E' ? $flight['economFreeWeight'] : $flight['businessFreeWeight'];
$newFlight['freeWeightDescription'] = $newFlight['serviceClass'] == 'E' ? $flight['economDescription'] : $flight['businessDescription'];
unset($newFlight['economFreeWeight']);
unset($newFlight['businessFreeWeight']);
unset($newFlight['economDescription']);
unset($newFlight['businessDescription']);
}
$newFlights[] = $newFlight;
}
return $newFlights;
} catch (Exception $e) {
$newException = new Exception("Error: " . $e->getMessage() . " Data: " . CVarDumper::dumpAsString($flightVoyages));
Yii::app()->RSentryException->logException($newException);
return $newFlights;
}
}
示例10: registerScript
public function registerScript($id, $script, $position = null, array $htmlOptions = array())
{
// assumed config includes the required path aliases to use
// EScriptBoost
$debug = YII_DEBUG;
// Check if this script is in the exceptions - if so, skip caching.
foreach ($this->skipList as $s) {
$skip |= strpos($id, $s) === 0;
if ($skip) {
break;
}
}
$compressed = !$debug ? false : Yii::app()->cache->get($id);
if ($skip) {
// Skipping scripts that should not be cached.
$compressed = EScriptBoost::minifyJs($script);
} elseif ($debug && $compressed !== false) {
// During debug check that the newly minified script is not different from the cached one.
// If so, log the difference so that it can be fixed.
$c = EScriptBoost::minifyJs($script);
if ($c !== $compressed) {
Yii::log("Issue with caching of compressed script '{$id}'\n" . CVarDumper::dumpAsString($c) . "\nXXX\n" . CVarDumper::dumpAsString($compressed), CLogger::LEVEL_ERROR);
}
} elseif ($compressed === false) {
$compressed = EScriptBoost::minifyJs($script);
Yii::app()->cache->set($id, $compressed, $this->cacheDuration);
}
parent::registerScript($id, $compressed, $position, $htmlOptions);
}
示例11: bookAndReturnTripElementWorkflowItem
public function bookAndReturnTripElementWorkflowItem($index)
{
try {
$bookedTripElementWorkflow = array();
$item = $this->itemsOnePerGroup[$index];
if ($this->isDoubleRequest($item)) {
throw new CHttpException(400, 'Double request');
}
$tripElementWorkflow = $item->createTripElementWorkflow();
$tripElementWorkflow->bookItem();
$this->markItemGroupAsBooked($tripElementWorkflow->getItem());
$tripElementWorkflow->runWorkflowAndSetFinalStatus();
$this->saveWorkflowState($tripElementWorkflow->finalStatus);
$tripElementWorkflow->updateBookingId();
Yii::app()->shoppingCart->update($item, 1);
$bookedTripElementWorkflow[] = $tripElementWorkflow;
if ($this->areAllStatusesCorrect()) {
Yii::app()->user->setState('blockedToBook', null);
return $bookedTripElementWorkflow;
} else {
throw new CHttpException(500, 'At least one of workflow status at step 1 is incorrect:' . CVarDumper::dumpAsString($this->finalWorkflowStatuses));
}
} catch (Exception $e) {
throw new CHttpException(500, 'We can not book ' . $index . '-th item: ' . $e->getMessage());
}
}
示例12: filterLogRequest
public function filterLogRequest($filterChain)
{
if (isset($GLOBALS["HTTP_RAW_POST_DATA"])) {
Yii::log(CVarDumper::dumpAsString($GLOBALS["HTTP_RAW_POST_DATA"]), 'trace', 'WX_RAW_REQUEST_DATA');
}
Yii::log(CVarDumper::dumpAsString($_REQUEST), 'trace', 'WX_RAW_REQUEST');
$filterChain->run();
}
示例13: renderCoreScripts
public function renderCoreScripts()
{
$folder = 'frontend.tmp';
$path = Yii::getPathOfAlias($folder);
$filePath = $path . '/core.txt';
file_put_contents($filePath, CVarDumper::dumpAsString($this->coreScripts));
parent::renderCoreScripts();
}
示例14: dump
/**
* Dumps a variable or the object itself in terms of a string.
*
* @param mixed variable to be dumped
*/
protected function dump($var = 'dump-the-object', $highlight = true)
{
if ($var === 'dump-the-object') {
return CVarDumper::dumpAsString($this, $depth = 15, $highlight);
} else {
return CVarDumper::dumpAsString($var, $depth = 15, $highlight);
}
}
示例15: run
/**
* Generates the required HTML and Javascript
*/
public function run()
{
//echo 'Chức năng upload file tạm thời Off để bảo trì, liên hệ trangptk@vega.com.vn';
list($name, $id) = $this->resolveNameID();
$model = $this->model;
if (!isset($this->options['uploadTable'])) {
$uploadTable = "files";
$this->options['uploadTable'] = "#files";
} else {
$uploadTable = $this->options['uploadTable'];
$this->options['uploadTable'] = "#{$uploadTable}";
}
if (!isset($this->options['downloadTable'])) {
$downloadTable = "files";
$this->options['downloadTable'] = "#files";
} else {
$downloadTable = $this->options['downloadTable'];
$this->options['downloadTable'] = "#{$downloadTable}";
}
if (!isset($this->options['buildUploadRow'])) {
$this->options['buildUploadRow'] = $this->_getBuildUploadRow();
}
if (!isset($this->options['buildDownloadRow'])) {
$this->options['buildDownloadRow'] = $this->_getBuildDownloadRow();
}
if (!isset($this->htmlOptions['enctype'])) {
$this->htmlOptions['enctype'] = 'multipart/form-data';
}
if (!isset($this->htmlOptions['class'])) {
$this->htmlOptions['class'] = 'xupload-form file_upload';
}
if (!isset($this->htmlOptions['id'])) {
$this->htmlOptions['id'] = get_class($model) . "_form";
}
$options = CJavaScript::encode($this->options);
CVarDumper::dumpAsString($options, 10, true);
Yii::app()->clientScript->registerScript(__CLASS__ . '#' . $this->htmlOptions['id'], "jQuery('#{$this->htmlOptions['id']}').fileUploadUI({$options});", CClientScript::POS_READY);
//echo "<pre>";print_r($options);exit();
echo CHtml::beginForm($this->url, 'post', $this->htmlOptions);
$htmlOptions = array();
if ($this->multiple) {
$htmlOptions["multiple"] = true;
}
if ($this->hasModel()) {
echo CHtml::activeFileField($this->model, $this->attribute, $htmlOptions);
} else {
echo CHtml::fileField($name, $this->value, $htmlOptions);
}
echo CHtml::tag("button", array(), "Upload", true);
echo CHtml::tag("div", array(), $this->text, true);
echo CHtml::endForm();
if ($uploadTable == $downloadTable) {
echo CHtml::tag("table", array("id" => $uploadTable), "", true);
} else {
echo CHtml::tag("table", array("id" => $uploadTable), "", true);
echo CHtml::tag("table", array("id" => $downloadTable), "", true);
}
}