本文整理汇总了PHP中CVarDumper类的典型用法代码示例。如果您正苦于以下问题:PHP CVarDumper类的具体用法?PHP CVarDumper怎么用?PHP CVarDumper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CVarDumper类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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'));
}
开发者ID:niranjan2m,项目名称:Voyanga,代码行数:29,代码来源:SaveTourAction.php
示例2: dump
public static function dump()
{
echo '<pre>';
CVarDumper::dump(func_get_args());
echo '<pre>';
exit;
}
开发者ID:wuhailin,项目名称:composer,代码行数:7,代码来源:Dump.php
示例3: 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);
}
开发者ID:Diakonrus,项目名称:fastweb-yii,代码行数:29,代码来源:EClientScriptBoost.php
示例4: d
/**
* Функция для отладки, печатает переменную с подсветкой синтаксиса
* @param mixed
*/
function d()
{
foreach (func_get_args() as $arg) {
CVarDumper::dump($arg, 10, true);
echo '<hr>';
}
}
开发者ID:xexys,项目名称:xca-backend,代码行数:11,代码来源:dump.php
示例5: 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'));
}
开发者ID:CenturyWarDesign,项目名称:umbrella,代码行数:25,代码来源:UmbrellaController.php
示例6: dump
/**
* Displays a variable.
* This method achieves the similar functionality as var_dump and print_r
* but is more robust when handling complex objects such as Yii controllers.
* @param mixed $var variable to be dumped
*/
public static function dump()
{
$args = func_get_args();
if (php_sapi_name() == "cli") {
foreach ($args as $k => $var) {
var_dump($var);
echo "\n";
}
return;
} else {
if (empty($_SERVER['SERVER_ADDR']) || empty($_SERVER['REMOTE_ADDR']) || $_SERVER['SERVER_ADDR'] !== $_SERVER['REMOTE_ADDR']) {
return;
}
}
$backTrace = debug_backtrace();
$backTrace = array_shift($backTrace);
echo '<div style="margin: 10px;border: 1px solid red;padding: 10px; background: #fff;">';
if (is_array($backTrace) && isset($backTrace['file']) && isset($backTrace['function']) && $backTrace['function'] === __FUNCTION__) {
echo "<b>{$backTrace['file']}</b> in line <b>{$backTrace['line']}</b> <br />";
echo '<div style="border-bottom:1px solid #006699;margin: 5px 0;"></div>';
}
foreach ($args as $k => $var) {
echo CVarDumper::dump($var, 10, true), '<br />';
}
echo "</div>";
}
开发者ID:Brother-Simon,项目名称:yii-debug-toolbar,代码行数:32,代码来源:YiiDebug.php
示例7: actionChangeState
public function actionChangeState($hotelBookerId = 0, $newState = '')
{
if ($hotelBookerId) {
/** @var HotelBookerComponent $hotelBookerComponent */
$hotelBookerComponent = new HotelBookerComponent();
$hotelBookerComponent->setHotelBookerFromId($hotelBookerId);
echo "HotelBookerId " . $hotelBookerComponent->getHotelBookerId() . PHP_EOL;
echo "Current status is " . $hotelBookerComponent->getCurrent()->swGetStatus() . PHP_EOL;
echo "Next possible status are " . $hotelBookerComponent->getCurrent()->swGetNextStatus() . PHP_EOL;
echo "Trying to change status to {$newState}" . PHP_EOL;
if ($newState) {
$res = $hotelBookerComponent->status($newState);
if (!$res) {
CVarDumper::dump($hotelBookerComponent->getCurrent()->getErrors());
CVarDumper::dump($hotelBookerComponent->getCurrent()->getAttributes());
echo PHP_EOL;
} else {
$hotelBookerComponent->getCurrent()->onlySave();
}
echo "Status is " . $hotelBookerComponent->getCurrent()->swGetStatus() . "\n";
}
} else {
$helpText = $this->getHelp();
$helpText = str_replace('command', 'ChangeState', $helpText);
echo $helpText;
}
}
开发者ID:niranjan2m,项目名称:Voyanga,代码行数:27,代码来源:HotelBookingCommand.php
示例8: 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;
}
}
开发者ID:niranjan2m,项目名称:Voyanga,代码行数:27,代码来源:FlightManager.php
示例9: 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;
}
}
开发者ID:CenturyWarDesign,项目名称:umbrella,代码行数:26,代码来源:BDLbs.php
示例10: 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;
}
开发者ID:hung5s,项目名称:yap,代码行数:36,代码来源:NestedBehavior.php
示例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());
}
}
开发者ID:niranjan2m,项目名称:Voyanga,代码行数:26,代码来源:OrderComponent.php
示例12: e
function e($msg, $exit = true, $depth = 10)
{
CVarDumper::dump($msg, $depth, true);
if ($exit) {
exit;
}
}
开发者ID:VishalSuriMcc,项目名称:jaspersiform,代码行数:7,代码来源:globals.php
示例13: 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));
}
开发者ID:aakbar24,项目名称:CollegeCorner_Ver_2.0,代码行数:34,代码来源:PostController.php
示例14: 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));
}
开发者ID:aakbar24,项目名称:CollegeCorner_Ver_2.0,代码行数:34,代码来源:WorkshopController.php
示例15: 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();
}
开发者ID:rzamarripa,项目名称:masoftproyectos,代码行数:34,代码来源:BTabs.php
示例16: 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));
}
开发者ID:aakbar24,项目名称:CollegeCorner_Ver_2.0,代码行数:35,代码来源:SlideController.php
示例17: 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();
}
开发者ID:CenturyWarDesign,项目名称:umbrella,代码行数:8,代码来源:WxBaseController.php
示例18: 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();
}
开发者ID:niranjan2m,项目名称:Voyanga,代码行数:8,代码来源:VClientScript.php
示例19: dump
function dump($var, $depth = 10, $highlight = true)
{
if (class_exists('CVarDumper')) {
CVarDumper::dump($var, $depth, $highlight);
} else {
var_dump($var);
}
}
开发者ID:tdimdimich,项目名称:wililhill.com,代码行数:8,代码来源:functions.php
示例20: getPageResults
public function getPageResults()
{
Console::writeLine('fetching');
$this->fetch();
file_put_contents(Yii::app()->basePath . '/reports/pagehtml.html', $this->pageHtml);
CVarDumper::dump($this->response, 10, false);
die('Debug Point');
}
开发者ID:evgeniys-hyuna,项目名称:leadsite,代码行数:8,代码来源:BingSearchEngine.php
注:本文中的CVarDumper类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论