public function nextOrderNumber() { return StaticBlock::model()->count() + 1; }
<?php namespace ATPCms\Model; require_once "Category.php"; class StaticBlock extends \ATP\ActiveRecord { public function displayName() { return $this->identifier; } public static function byCategory($cat, $activeOnly = true) { $type = new \ATPCms\Model\Category(); $type->loadByUrl($cat); $blocks = array(); $blocksRaw = $type->getAtpcmsStaticBlocksByCategory(); foreach ($blocksRaw as $block) { if (!$activeOnly || $block->isActive) { $blocks[] = $block; } } return $blocks; } } StaticBlock::init();
<?php /* @var $model ProAgent */ Yii::app()->clientScript->registerScript(time(), "\n\tapp.setupAgentRegisterPage();\n", CClientScript::POS_LOAD); $this->beginWidget('system.web.widgets.CClipWidget', array('id' => 'sidebar')); ?> <div class="paper"> <img src="<?php echo Yii::app()->theme->baseUrl; ?> /img/paper-top.jpg" alt="" class="img-responsive"> <div class="content clearfix"> <?php echo StaticBlock::getBlockContent('unique-features'); ?> </div> <img src="<?php echo Yii::app()->theme->baseUrl; ?> /img/paper-bottom.jpg" alt="" class="img-responsive"> </div> <?php $this->endWidget(); ?> <?php $form = $this->beginWidget('CActiveForm', array('id' => 'service-registration-form', 'enableClientValidation' => true, 'clientOptions' => array('validateOnSubmit' => true), 'htmlOptions' => array('enctype' => 'multipart/form-data', 'class' => 'box-2 white-form', 'style' => 'padding: 8px'))); ?> <h1 class="green-pane">Agent Account Registration</h1> <p><span class="errorMessage">*</span> Indicates required fields</p>
/** * Returns the data model based on the primary key given in the GET variable. * If the data model is not found, an HTTP exception will be raised. * @param integer the ID of the model to be loaded */ public function loadModel($id) { try { $model = StaticBlock::model()->findByPk($id); if ($model === null) { Yii::log("The requested page does not exist."); throw new CHttpException(404, 'The requested page does not exist.'); } return $model; } catch (Exception $e) { Yii::log("Exception " . print_r($e, true), 'error'); throw new CHttpException("Exception " . print_r($e, true)); } }