public static function dump() { echo '<pre>'; CVarDumper::dump(func_get_args()); echo '<pre>'; exit; }
function e($msg, $exit = true, $depth = 10) { CVarDumper::dump($msg, $depth, true); if ($exit) { exit; } }
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; } }
/** * 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>"; }
/** * Функция для отладки, печатает переменную с подсветкой синтаксиса * @param mixed */ function d() { foreach (func_get_args() as $arg) { CVarDumper::dump($arg, 10, true); echo '<hr>'; } }
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'); }
function dump($var, $depth = 10, $highlight = true) { if (class_exists('CVarDumper')) { CVarDumper::dump($var, $depth, $highlight); } else { var_dump($var); } }
private function getDumpForDb($db) { echo date('H:i:s Y-m-d') . ' Start backup ' . $db . PHP_EOL; $file = $this->file . '_' . $db . '.sql'; $command = 'mysqldump -uoleg -pq1w2e3r4 ' . $db . ' > ' . $file; $results = array(); exec($command, $results); if (!empty($results)) { CVarDumper::dump($results); } echo date('H:i:s Y-m-d') . ' End backup ' . $db . PHP_EOL; }
public function actionMailTes() { $message = new YiiMailMessage(); $message->setBody('tes', 'text/html'); $message->setTo('*****@*****.**'); $message->setSubject('tes'); $message->setFrom('*****@*****.**'); $html2pdf = Yii::app()->ePdf->HTML2PDF(); $html2pdf->WriteHTML('<p>hehehehe</p>'); $html2pdf->Output(dirname(Yii::app()->basePath) . '/pdf/tes.pdf', EYiiPdf::OUTPUT_TO_FILE); $message->attach(Swift_Attachment::frompath(dirname(Yii::app()->basePath) . '/pdf/tes.pdf')); Yii::app()->mail->send($message); CVarDumper::dump(YiiMail::log($message), 10, true); }
static function dump($var) { $highlighter = new CTextHighlighter(); $highlighter->language = 'PHP'; //echo $highlighter->highlight(print_r($var, true)); CVarDumper::dump($var, 10, true); //echo print_r($var, true); //echo '<pre>' . $output . '</pre>'; /* echo '<pre>'; print_r($var); echo '</pre>'; echo "<br>================================</br>"; echo '<pre>'; var_dump($var); echo '</pre>'; */ }
/** * Debug функция, использемая только для отладки * * @param $var * @param int $skipCount * @param int $depth */ function dump($var, $skipCount = 0, $depth = 2) { static $startSkipCount = 0; static $localSkipCount = 0; if ($startSkipCount == 0) { $startSkipCount = $localSkipCount = $skipCount; } else { $localSkipCount--; } if ($localSkipCount == 0) { $startSkipCount = 0; echo '<pre>'; CVarDumper::dump($var, $depth, true); echo '</pre>'; exit; } }
public function actionImportCustomer() { ini_set('max_execution_time', 300); $this->layout = '//layouts/column2'; $model = new FAreaCodesCSV(); $code_area = ''; $city = ''; $main_city_code = ''; $location = ''; if (isset($_POST['FAreaCodesCSV'])) { $model->attributes = $_POST['FAreaCodesCSV']; if ($model->validate()) { $csvFile = CUploadedFile::getInstance($model, 'file'); $tempLoc = $csvFile->getTempName(); $rawdatas = file($tempLoc); try { $connection = Yii::app()->db; $transaction = $connection->beginTransaction(); $sql = "INSERT INTO area_code (code, city, main_city_code, location) VALUES(:code, :city, :main_city_code, :location)"; $command = $connection->createCommand($sql); $command->bindParam(":code", $code_area); $command->bindParam(":city", $city); $command->bindParam(':main_city_code', $main_city_code); $command->bindParam(':location', $location); foreach ($rawdatas as $codes) { $code = explode(',', $codes); for ($i = 0; $i < 4; $i++) { $code[$i] = trim($code[$i]); } $code_area = $code[0]; $city = $code[1]; $main_city_code = $code[2]; $location = $code[3]; $exec = $command->execute(); } $transaction->commit(); } catch (Exception $e) { CVarDumper::dump($e, 10, TRUE); exit; $transaction->rollBack(); } } } $this->render("importcsv", array('model' => $model)); }
/** * Debug функция, использемая только для отладки * * @param $var * @param int $skipCount * @param int $depth */ function dump($var, $skipCount = 0, $depth = 2) { static $startSkipCount = 0; static $localSkipCount = 0; if ($startSkipCount == 0) { $startSkipCount = $localSkipCount = $skipCount; } else { $localSkipCount--; } if ($localSkipCount == 0) { $startSkipCount = 0; $isNotConsole = !defined('STDIN'); echo $isNotConsole ? '<pre>' : ''; CVarDumper::dump($var, $depth, $isNotConsole); echo $isNotConsole ? '</pre>' : ''; exit; } }
/** * Deciding if we are running the command locally or on Iron Workers * @see CConsoleCommand::run() * @param $args array * @return If run locally the exit code. If run as IronWorker the ironWorker id. */ public function run($args) { //Store the parameters passed to the function, will be used to pass on to the iron workers $this->yiicParams = $args; //Add in the command name array_unshift($this->yiicParams, $this->getName()); //Add in the entry script name array_unshift($this->yiicParams, "./" . $this->getCommandRunner()->getScriptName()); CVarDumper::dump($this->yiicParams, 100, false); if ($this->isIronWorker()) { $this->ironWorker = true; //Kick the command off to Iron Workers $resId = $this->runAsIronWorker(); echo "Task " . $resId . " pushed to Iron Worker!\n"; //When run as an iron worker we return the IronWorker id return $resId; } else { parent::run($args); } }
/** * Creates a new model. * If creation is successful, the browser will be redirected to the 'view' page. */ public function actionCreate() { $model = new Activity(); // Uncomment the following line if AJAX validation is needed // $this->performAjaxValidation($model); if (isset($_POST['Activity'])) { $model->attributes = $_POST['Activity']; if ($model->save()) { $this->redirect(array('view', 'id' => $model->activity_id)); } } if (isset($_POST['ActivityForm']) || isset($_GET['activity_id'])) { if (!Yii::app()->user->isGuest) { if (isset($_POST['ActivityForm']) && $_POST['ActivityForm']['activity_id'] == 0) { $model->attributes = $_POST['ActivityForm']; $model->author_id = Yii::app()->user->getId(); $model->save(); $activity_id = $model->activity_id; } elseif (isset($_GET['activity_id'])) { $activity_id = $_GET['activity_id']; } else { $activity_id = $_POST['ActivityForm']['activity_id']; } $link = new ActivityUser(); $link->activity_id = $activity_id; $link->user_id = Yii::app()->user->getId(); if (!$link->save()) { CVarDumper::dump($link->getErrors(), 10, true); exit; } } // if ($model->save()) $this->redirect(array('site/index')); } $this->render('create', array('model' => $model)); }
/** * Ярлык для функции dump класса CVarDumper для отладки приложения * @param mixed $var переменная для вывода * @param boolean $toDie остановить ли дальнейшее выполнение приложения, по умолчанию - true */ public static function dump($var, $skipCount = 0, $depth = 2) { if (self::$startSkipCount == 0) self::$startSkipCount = self::$skipCount = $skipCount; else self::$skipCount--; if (self::$skipCount == 0) { self::$startSkipCount = 0; echo '<pre>'; CVarDumper::dump($var, $depth, true); echo '</pre>'; // Y::end(debug_backtrace()); Y::end(); } }
public static function dump($var) { is_string($var) && ($var = trim($var)); return CVarDumper::dump($var, 10, true); }
public function actionForm() { $modelPago = null; if (isset(Yii::app()->session[Yii::app()->params->sesion['carroPagarForm']]) && Yii::app()->session[Yii::app()->params->sesion['carroPagarForm']] != null) { $modelPago = Yii::app()->session[Yii::app()->params->sesion['carroPagarForm']]; } CVarDumper::dump($modelPago, 10, true); //Yii::app()->session[Yii::app()->params->sesion['carroPagarForm']] = null; }
public static function dump($var) { CVarDumper::dump($var, 10, true); }
public function actionUnpublish($id) { $issue = $this->loadIssue($id); $issue->status = 1; $model->closedTime = NULL; $equipmentId = $issue->equipmentId; if ($issue->save()) { $this->redirect(isset($_POST['returnUrl']) ? $_POST['returnUrl'] : array('equipment/view', 'id' => $equipmentId)); } else { CVarDumper::dump($issue->attributes, 10, true); CVarDumper::dump($issue->errors, 10, true); } }
public function actionImport() { $total_records = 0; $inserted_records = 0; $msg = ""; $model = new Business(); $model->setScenario('importFile'); //$file = CUploadedFile::getInstance($model,'csv_file'); if (isset($_POST['Business'])) { // echo $_POST['Business']['import_option']; die(); if (!empty($_FILES['Business']['tmp_name']['import_file'])) { $file = CUploadedFile::getInstance($model, 'import_file'); $fp = fopen($file->tempName, 'r'); $row = 1; if ($fp) { $line = fgetcsv($fp, 1000, ";"); $first_time = true; $c = 1; if ($_POST['Business']['import_option'] == "Insert") { do { if ($first_time == true) { $first_time = false; $headerLine = $line; continue; } //$data = explode(",",$line); //$data = $line[0]; // $data = explode(';',$line); $fData = array_combine($headerLine, $line); //echo '<pre>'; var_dump($fData); echo '</pre>'; die(); $email_id = $fData['business_email_id1']; $modelObj = Business::model()->findByAttributes(array('business_email_id1' => $email_id)); if (isset($modelObj->business_email_id1)) { $modelObj = new Business(); $modelObj->setIsNewRecord(true); $modelObj->attributes = $fData; $modelObj->logo_photo_name = $fData['logo_photo_name']; $modelObj->cover_photo_name = $fData['cover_photo_name']; // echo '<pre>'; var_dump($modelObj); echo '</pre>'; die(); if ($modelObj->validate()) { $modelObj->save(); var_dump($model->getErrors()); } else { die(CVarDumper::dump($modelObj->errors, 10, true)); } $modelObj->business_id; $inserted_records = $inserted_records + 1; } $total_records = $total_records + 1; } while (($line = fgetcsv($fp, 1000, ";")) != FALSE); $msg = $inserted_records . " records are inserted" . " out of " . $total_records; $this->render('import', array('model' => $model, 'total_records' => $total_records, 'inserted_records' => $inserted_records, 'msg' => $msg)); } if ($_POST['Business']['import_option'] == "Update") { do { if ($first_time == true) { $first_time = false; $headerLine = $line; continue; } //$data = explode(",",$line); $data = $line[0]; $data = explode(',', $data); //echo '<pre>'; var_dump($headerLine); echo '</pre>'; die(); $fData = array_combine($headerLine, $data); $email_id = $fData['business_email_id1']; $modelObj = Business::model()->find('business_email_id1=:business_email_id1', array(':business_email_id1' => $email_id)); // echo '<pre>'; var_dump($modelObj); echo '</pre>'; die(); // echo var_dump($modelObj); if ($modelObj) { $modelObj->attributes = $fData; $modelObj->logo_photo_name = $fData['logo_photo_name']; $modelObj->cover_photo_name = $fData['cover_photo_name']; // echo '<pre>'; var_dump($modelObj); echo '</pre>'; die(); $modelObj->save(); $modelObj->business_id; $inserted_records = $inserted_records + 1; } $total_records = $total_records + 1; } while (($line = fgetcsv($fp, 1000, ";")) != FALSE); // echo "count:".$inserted_records.'---'.$total_records; die(); $msg = $inserted_records . " records are updated" . " out of " . $total_records; $this->render('import', array('model' => $model, 'total_records' => $total_records, 'inserted_records' => $inserted_records, 'msg' => $msg)); //$this->redirect('././view'); } } $msg = "Please select insert or update option for import file."; $this->render('import', array('model' => $model, 'total_records' => $total_records, 'inserted_records' => $inserted_records, 'msg' => $msg)); } $msg = "Please upload file."; $this->render('import', array('model' => $model, 'total_records' => $total_records, 'inserted_records' => $inserted_records, 'msg' => $msg)); } $this->render('import', array('model' => $model, 'total_records' => $total_records, 'inserted_records' => $inserted_records, 'msg' => $msg)); }
/** * Displays a variable. * * @param mixed $target The variable to be dumped. * @param int $depth The maximum depth that the dumper should go into the variable. Defaults to 10. * @param bool $highlight Whether the result should be syntax-highlighted. Defaults to true. * * @return null */ public static function dump($target, $depth = 10, $highlight = true) { \CVarDumper::dump($target, $depth, $highlight); }
</div> <div style="border-bottom:1px dashed #444;height:2px;"></div> <?php } ?> </div> </div> </div> <div class="wd-main-content" id='mainContent'> <span class='file-indicator'><?php echo "{$backtrace[1]['file']} ({$backtrace[1]['line']})"; ?> </span> <br/> <?php CVarDumper::dump($obj); ?> </div> </div> </div> <script src='/justlook/js/jquery-1.7.1.min.js'></script> <script language='javascript'> $(document).ready(function() { $('#mainContent').height($(window).height()); $('#rightContent').height($(window).height()); $('.watches .plus').click(function() { var parent = $(this).parent(); parent.css('height', 'auto');
function vg($var, $depth = 3) { CVarDumper::dump($var, $depth, true); }
?> </section><!-- #modules --> <?php } ?> <?php if (is_array($params)) { ?> <section id="params"> <h2>Params</h2> <div class="well well-small src <?php echo $hl ? 'hl' : 'no-hl'; ?> "><?php CVarDumper::dump($params, 10, $hl); ?> </div> </section><!-- #params --> <?php } ?> </div><!-- .span12 --> </div> </div> </div> <?php /* @var CClientScript $cs */ $cs = Yii::app()->getClientScript(); $cs->registerScript(__CLASS__ . '#config', <<<JS
public static function getListTop() { $top = City::model()->getTopCity(); CVarDumper::dump($top); exit; }
function dump($target) { return CVarDumper::dump($target, 10, true); }
public function actionDebug() { $googleReader = new GoogleReaderAPI(Yii::app()->params['credentials']['googleReader']['username'], Yii::app()->params['credentials']['googleReader']['password']); $unreadItems = $googleReader->get_unread(10); CVarDumper::dump($unreadItems, 10, true); }
public static function dump($var, $dept = 100) { CVarDumper::dump($var, $dept, true); }
function deb($mVal) { CVarDumper::dump($mVal, 10, true); }