<?php echo $form->labelEx($model, 'name'); ?> <?php echo $form->textField($model, 'name'); ?> <?php echo $form->error($model, 'name'); ?> </div> <div class="row"> <?php echo $form->labelEx($model, 'attributeType'); ?> <?php echo $form->dropDownList($model, 'attributeType', CHtml::listData(EvaAttributeTypes::model()->findAll(), 'id', 'name')); ?> <?php echo $form->error($model, 'attributeType'); ?> </div> <div class="row"> <?php echo $form->labelEx($model, 'description'); ?> <?php echo $form->textArea($model, 'description', array('rows' => 25, 'cols' => 70)); ?> <?php echo $form->error($model, 'description'); ?>
/** * @param int $descId * @return void */ public function actionEvaAttributes($descId = 0) { Yii::log("actionEvaAttributes called", "trace", self::LOG_CAT); if ($descId > 0) { $description = EvaAttributes::model()->findByPk($descId, ['select' => 'description']); //print_r($description); die; // The Regular Expression filter // $regExUrl = '/(http|https|ftp|ftps)\:\/\/[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,3}(\/\S*)?/'; // Check if there is a url in the text $attrDescription = UtilModel::urlToLink($description->description); // if (preg_match($regExUrl, $description->description, $url)) { // // // make the urls hyper links // $attrDescription = preg_replace($regExUrl, "<a href=\"{$url[0]}\" target=\"_blank\">{$url[0]}</a>", // $description->description); // // } echo json_encode(['description' => "<p>{$attrDescription}</p>"]); return; } $evaAttributes = CHtml::listData(EvaAttributes::model()->with('attributeTypes')->findAll(), 'attributeId', 'name', function ($attribute) { return $attribute->attributeTypes->name; }); //die; $tableColumns = CHtml::listData(EvaAttributeTypes::model()->findAll(), 'id', 'name'); // Load / save page instructions if (isset($_POST['pageId'])) { SystemController::savePage($this->createUrl('evaAttributes')); } $page = SystemController::getPageContent('evaAttributesList'); if (empty($page)) { Yii::app()->user->setFlash('notice', 'This page is missing some information'); } $this->render('evaAttributes', ['tableColumns' => $tableColumns, 'evaAttributes' => $evaAttributes, 'page' => $page]); }