当前位置: 首页>>代码示例>>PHP>>正文


PHP Helper::rootImg方法代码示例

本文整理汇总了PHP中Helper::rootImg方法的典型用法代码示例。如果您正苦于以下问题:PHP Helper::rootImg方法的具体用法?PHP Helper::rootImg怎么用?PHP Helper::rootImg使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Helper的用法示例。


在下文中一共展示了Helper::rootImg方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: beforeSave

 public function beforeSave()
 {
     $roles = Rights::getAssignedRoles(Yii::app()->user->Id);
     // check for single role
     foreach ($roles as $role) {
         if ($role->name == 'Editor' or $role->name == 'Administrator' or $role->name == 'Superadmin') {
             $this->post_editor = Yii::app()->user->id;
         } else {
             $this->post_author = Yii::app()->user->id;
         }
     }
     if ($this->isNewRecord) {
         // jika record baru jalankan
         $this->post_created = date('Y-m-d H:i:s');
     }
     if ($this->post_name == '') {
         $this->post_name = 'No Title';
     }
     if ($this->post_link == '') {
         $this->post_link = $this->post_name;
     }
     if ($this->post_title == '') {
         $this->post_title = $this->post_name;
     }
     $this->post_type = $this->_type;
     $this->post_image = str_replace(Helper::rootImg('content'), '', $this->post_image);
     return parent::beforeSave();
 }
开发者ID:beckblurry,项目名称:Yii1-Base-Core-V.Alpha.1,代码行数:28,代码来源:Video.php

示例2: beforeSave

 public function beforeSave()
 {
     // create thumb with ext easyImage -> check components/helper and extensions/easyimage
     Helper::createThumb(array('thumbDir' => Helper::rootImg('content/.thumb'), 'imageDir' => Helper::rootImg('content'), 'image' => $this->photo, 'small' => array('width' => 100, 'height' => 100, 'type' => EasyImage::RESIZE_HEIGHT), 'medium' => array('width' => 300, 'height' => 150, 'type' => EasyImage::RESIZE_WIDTH), 'large' => array('width' => 600, 'height' => 350, 'type' => EasyImage::RESIZE_WIDTH)));
     $this->photo = str_replace(Helper::rootImg('content'), '', $this->photo);
     return parent::beforeSave();
 }
开发者ID:beckblurry,项目名称:Yii1-Base-Core-V.Alpha.1,代码行数:7,代码来源:Photometa.php

示例3: beforeSave

 public function beforeSave()
 {
     $this->images = str_replace(Helper::rootImg('content'), '', $this->images);
     $this->taxonomy = $this->_taxonomy;
     $this->name = Ucfirst($this->name);
     return true;
 }
开发者ID:beckblurry,项目名称:Yii1-Base-Core-V.Alpha.1,代码行数:7,代码来源:Sliders.php

示例4: process

 private function process($data, $model)
 {
     $setting = array();
     foreach ($data as $key) {
         $setting[$key] = $this->loadSetting($key);
         $model->{$key} = $setting[$key]->option_value;
     }
     if (isset($_POST['Form_API'])) {
         $transaction = Yii::app()->db->beginTransaction();
         try {
             $model->attributes = $_POST['Form_API'];
             if ($model->validate()) {
                 foreach ($data as $key) {
                     $setting[$key]->option_value = str_replace(Helper::rootImg('content'), '', $_POST['Form_API'][$key]);
                     if (!$setting[$key]->save()) {
                         throw new Exception($setting[$key]->getError('value'));
                     }
                 }
                 $transaction->commit();
                 $message = "<strong>Well done!</strong> You successfully Update Settings";
                 Yii::app()->user->setFlash('info', $message);
                 $this->refresh();
             }
         } catch (Exception $e) {
             $transaction->rollBack();
             Yii::app()->user->setFlash('error', "{$e->getMessage()}");
             $this->refresh();
         }
     }
 }
开发者ID:beckblurry,项目名称:Yii1-Base-Core-V.Alpha.1,代码行数:30,代码来源:ApiController.php

示例5: beforeSave

 public function beforeSave()
 {
     if ($this->parent != '' and $this->parent != 0) {
         $parent = $this->model()->resetScope()->findByPk((int) $this->parent);
         if ($this->slug == '') {
             $this->slug = $parent->slug . '-' . $this->name;
         } else {
             if ($this->isNewRecord) {
                 $this->slug = $parent->slug . '-' . $this->slug;
             } else {
                 $model = $this->model()->resetScope()->findByPk((int) $this->term_id);
                 if ($model->slug != $this->slug) {
                     $this->slug = $parent->slug . '-' . $this->slug;
                 }
             }
         }
     } else {
         if ($this->slug == '') {
             $this->slug = $this->name;
         }
     }
     $this->images = str_replace(Helper::rootImg('content'), '', $this->images);
     $this->taxonomy = $this->_taxonomy;
     $this->name = Ucfirst($this->name);
     return parent::beforeSave();
 }
开发者ID:beckblurry,项目名称:Yii1-Base-Core-V.Alpha.1,代码行数:26,代码来源:TermParent.php

示例6: actionHeadermobile

 public function actionHeadermobile()
 {
     $model = new Form_Headers_Mobile();
     $setting = array();
     foreach (get_object_vars($model) as $key => $null) {
         $setting[$key] = $this->loadSetting($key);
         $model->{$key} = $setting[$key]->option_value;
     }
     if (isset($_POST['Form_Headers_Mobile'])) {
         $transaction = Yii::app()->db->beginTransaction();
         try {
             $model->attributes = $_POST['Form_Headers_Mobile'];
             if ($model->validate()) {
                 foreach (get_object_vars($model) as $key => $null) {
                     $setting[$key]->option_value = str_replace(Helper::rootImg('content'), '', $_POST['Form_Headers_Mobile'][$key]);
                     if (!$setting[$key]->save()) {
                         throw new Exception($setting[$key]->getError('value'));
                     }
                 }
                 $transaction->commit();
                 $message = "<strong>Well done!</strong> You successfully Update Settings";
                 Yii::app()->user->setFlash('info', $message);
                 $this->refresh();
             }
         } catch (Exception $e) {
             $transaction->rollBack();
             Yii::app()->user->setFlash('error', "{$e->getMessage()}");
             $this->refresh();
         }
     }
     $this->render('mobile', compact('model', 'data'));
 }
开发者ID:beckblurry,项目名称:Yii1-Base-Core-V.Alpha.1,代码行数:32,代码来源:HeaderController.php

示例7: setWidget

 protected function setWidget()
 {
     $child = get_called_class();
     include_once $child . '/models/model_' . $child . '.php';
     $modelClass = "model_{$child}";
     $model = new $modelClass();
     // set value of model property
     foreach (get_object_vars($model) as $property => $value) {
         if (isset($this->data[$property])) {
             $model->{$property} = $this->data[$property];
         }
     }
     // check if widget is isset and set attributes for validation
     if (isset($_POST[$this->param['ID'] . '-save'])) {
         $model->attributes = $_POST[$modelClass];
     }
     // check validation
     if (isset($_POST[$this->param['ID'] . '-save']) && $model->validate()) {
         // mulai transaksi
         $transaction = Yii::app()->db->beginTransaction();
         try {
             foreach ($_POST[$modelClass] as $field => $fd) {
                 $array["{$field}"] = $fd;
             }
             $array['last_update'] = date('Y-m-d H:i:s');
             if (isset($_POST['visibleOn'])) {
                 $array['visibleOn'] = $_POST['visibleOn'];
             }
             $model = Widget::model()->findByPk((int) $this->param['ID']);
             if ($model !== null) {
                 $model->description = serialize(str_replace(Helper::rootImg('content'), '', $array));
                 if ($model->save(false)) {
                     $transaction->commit();
                     $message = "<strong>Well done!</strong> You successfully Saving";
                     Yii::app()->user->setFlash('success', $message);
                     $this->controller->refresh();
                 } else {
                     Yii::app()->user->setFlash('error', "on error occured, please try again");
                 }
             } else {
                 Yii::app()->user->setFlash('error', "on error occured, please try again");
             }
         } catch (Exception $e) {
             $transaction->rollBack();
             if (true == YII_DEBUG) {
                 Yii::app()->user->setFlash('error', "{$e->getMessage()}");
             } else {
                 Yii::app()->user->setFlash('error', "on error occured, please try again");
             }
             // for production
             // $this->refresh();
         }
     } else {
         $this->render('_form', array('model' => $model, 'param' => $this->param, 'data' => $this->data));
     }
 }
开发者ID:beckblurry,项目名称:Yii1-Base-Core-V.Alpha.1,代码行数:56,代码来源:setWidgets.php

示例8: metaHead

 public function metaHead()
 {
     if ($this->favicon != '') {
         echo '<link rel="shortcut icon" href="' . Helper::rootImg('content', $this->favicon) . '" />';
     }
     echo '<link rel="canonical" href="' . Yii::app()->getBaseUrl(true) . Yii::app()->request->requestUri . '" />';
     if ($this->keyword != '') {
         echo '<meta name="keywords" content="' . $this->keyword . '" />';
     }
     if ($this->description != '') {
         echo '<meta name="description" content="' . $this->description . '" />';
     }
     if ($this->metaHead != '') {
         echo $this->metaHead;
     }
     echo '<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />';
     echo '<meta http-equiv="imagetoolbar" content="no" />';
     echo '<meta name="language" content="Indonesia" />';
     echo '<meta name="generator" content="' . Yii::app()->params['system_name'] . '"/>';
     echo '<meta name="revisit-after" content="7" />';
     echo '<meta name="webcrawlers" content="all" />';
     echo '<meta name="rating" content="general" />';
     echo '<meta name="spiders" content="all" />';
     echo '<meta http-equiv="refresh" content="900;url=' . Yii::app()->getBaseUrl(true) . Yii::app()->request->requestUri . '" />';
     echo '<link rel="alternate" type="application/rss+xml" title="' . $this->pageTitle . '" href="' . Yii::app()->createAbsoluteUrl('/rss/terbaru') . '" />';
     echo '<meta content="' . $this->pageTitle . '" name="title" />';
     echo '<meta name="robots" content="index,follow" />';
     echo '<meta name="googlebot" content="all" />';
     echo '<meta  property="fb:app_id" content="1403183346590415" />';
     echo '<meta property="og:site_name" content="' . Yii::app()->params['system_name'] . '" />';
     echo '<meta property="og:title" content="' . $this->pageTitle . '" />';
     echo '<meta property="og:type" content="article" />';
     if ($this->image != '') {
         echo '<meta property="og:image" content="' . $this->image . '" />';
     }
     echo '<meta property="og:url" content="' . Yii::app()->getBaseUrl(true) . Yii::app()->request->requestUri . '" />';
     if ($this->description != '') {
         echo '<meta property="og:description" content="' . $this->description . '" />';
     }
 }
开发者ID:beckblurry,项目名称:Yii1-Base-Core-V.Alpha.1,代码行数:40,代码来源:WebController.php

示例9: count

// count jika record baru = 1 jika bukan ambil dari count $model->photometa
$updateCount = $model->isNewRecord ? 1 : count($model->photometa);
// total photo di ambil dari hasil GET maupun dari updateCount
$photos = isset($_GET['photos']) ? (int) $_GET['photos'] : $updateCount;
$photos = $photos > 50 ? 49 : $photos;
$photos = $photos == '' ? 1 : $photos;
// box mulai
$this->beginWidget('bootstrap.widgets.TbBox', array('title' => $photos . ' Photos'));
// membuat function untuk set nilai value
function setupValue($model, $loop, $keyVal)
{
    $updateValue = $model->isNewRecord ? '' : isset($model->photometa[$loop]->{$keyVal}) ? $model->photometa[$loop]->{$keyVal} : '';
    return isset($_POST['Photometa'][$loop][$keyVal]) ? $_POST['Photometa'][$loop][$keyVal] : $updateValue;
}
// mulai looping
for ($i = 0; $i < $photos; $i++) {
    // set value untuk widget hasil custom elfinder "CustomArrayServerFileInput" untuk property photo
    $valuePhoto = setupValue($model, $i, 'photo');
    echo "<div class='well'>";
    // elfinder serverfileinput hasil "custom"
    $this->widget('CustomArrayServerFileInput', array('name' => "Photometa[{$i}][photo]", 'value' => $valuePhoto, 'connectorRoute' => $this->moduleName() . '/elfinder/connector/', 'htmlOptions' => array('height' => 30, 'id' => $i . 'photos'), 'buttonOptions' => array('label' => '<i class="fa fa-camera"></i> Upload Gambar', 'class' => 'btn btn-primary'), 'customSet' => array('imageOptions' => array('style' => 'max-width:100%;'), 'rootImg' => Helper::rootImg('content'))));
    echo "<br>";
    // set value untuk property credit_photo
    $valuePhotoCredit = setupValue($model, $i, 'photo_credit');
    // textarea field
    echo CHtml::textArea("Photometa[{$i}][photo_credit]", $valuePhotoCredit, array('class' => 'span12', 'placeholder' => 'Keterangan'));
    echo "</div>";
    // end loop
}
// box berakhir
$this->endWidget();
开发者ID:beckblurry,项目名称:Yii1-Base-Core-V.Alpha.1,代码行数:31,代码来源:_formImages.php

示例10: array_merge

<?php

$htmlLink = array_merge($htmlOptions, array('href' => $this->data('header_link')));
echo CHtml::openTag("a", $htmlLink);
if ($this->data('header_images') != '') {
    echo CHtml::Image(Helper::rootImg('content', $this->data('header_images')), $this->data('header_alt'), array('title' => $this->data('header_title'), 'width' => $this->data('header_width'), 'height' => $this->data('header_height'), 'style' => $this->data('header_style')));
} else {
    echo "<h1>" . $this->data('header_title') . "</h1>";
}
echo CHtml::closeTag("a");
开发者ID:beckblurry,项目名称:Yii1-Base-Core-V.Alpha.1,代码行数:10,代码来源:index.php

示例11: array

echo $form->textFieldRow($model, 'name', array('class' => 'span12'));
?>
	<p class='muted'>Nama yang akan Tampil.</p><hr>
	
	<?php 
echo $form->textFieldRow($model, 'slug', array('class' => 'span12'));
?>
	<p class=' muted'>'slug' adalah versi URL dari nama.
Dalam hal ini berupa huruf kecil semua dan hanya mengandung huruf,
angka, dan tanda (-). <br>(Jika Kosong maka akan di isi otomatis.)</p><hr>
	
            <?php 
echo $form->textAreaRow($model, 'description', array('class' => 'span12', 'rows' => '3'));
?>
        <hr>
	
        Image
        <?php 
$this->widget('CustomServerFileInput', array('model' => $model, 'attribute' => 'images', 'connectorRoute' => $this->moduleName() . '/elfinder/connector', 'htmlOptions' => array('height' => 30), 'buttonOptions' => array('label' => 'Upload Gambar', 'class' => 'btn'), 'customSet' => array('modelName' => 'Tag', 'modelVal' => $model->images, 'rootImg' => Helper::rootImg('content'))));
?>
  
	 
	<hr>
	<?php 
$this->widget('bootstrap.widgets.TbButton', array('buttonType' => 'submit', 'type' => $model->isNewRecord ? 'info' : 'warning', 'label' => $model->isNewRecord ? 'Buat' : 'Ubah', 'loadingText' => 'Mohon Tunggu'));
?>
        <hr>
 
	 
	<?php 
$this->endWidget();
开发者ID:beckblurry,项目名称:Yii1-Base-Core-V.Alpha.1,代码行数:31,代码来源:_form.php

示例12: array

echo $form->textFieldRow($model, "header_alt", array('class' => 'span6', 'placeholder' => 'Alt image'));
echo $form->textFieldRow($model, "header_link", array('class' => 'span6', 'placeholder' => 'http://'));
echo $form->textAreaRow($model, "header_style", array('class' => 'span9', 'placeholder' => ''));
?>
 
</div></div>
<hr>


<div class='row-fluid'>
<div class='span2'>
<b>Favicon</b>	
</div>
<div class='span10'>
   <?php 
$this->widget('CustomServerFileInput', array('model' => $model, 'attribute' => 'header_favicon', 'connectorRoute' => $this->moduleName() . '/elfinder/connector', 'htmlOptions' => array('height' => 30), 'buttonOptions' => array('label' => '<i class="fa fa-camera"></i> Favicon', 'class' => 'btn btn-primary'), 'customSet' => array('modelName' => 'Form_Headers', 'modelVal' => $model->header_favicon, 'rootImg' => Helper::rootImg('content'))));
?>
<hr>	
<p class='muted'>Ukuran terbaik adalah 50px x 50px px dan tipe file adalah png/jpg/ico</p>
</div></div> 
 
 
<hr>
	<?php 
$this->widget('bootstrap.widgets.TbButton', array('buttonType' => 'submit', 'type' => 'info', 'label' => 'Simpan'));
?>
</div>
</div> <!--end row-->

<?php 
$this->endWidget();
开发者ID:beckblurry,项目名称:Yii1-Base-Core-V.Alpha.1,代码行数:31,代码来源:index.php

示例13: array

<?php

/* start box Categories */
$this->beginWidget('bootstrap.widgets.TbBox', array('title' => 'Gambar', 'headerIcon' => 'icon-eye-open'));
?>

  <?php 
$this->widget('CustomServerFileInput', array('model' => $model, 'attribute' => 'post_image', 'connectorRoute' => $this->moduleName() . '/elfinder/connector/', 'htmlOptions' => array('height' => 30), 'buttonOptions' => array('label' => 'Upload Gambar', 'class' => 'btn'), 'customSet' => array('modelName' => 'Post', 'modelVal' => $model->post_image, 'imageOptions' => array('style' => 'max-width:100%;margin-top:-10px;'), 'rootImg' => Helper::rootImg('content'))));
?>
 <br>
 
<hr>
<?php 
echo $form->textFieldRow($model, 'post_image_by');
echo $form->textAreaRow($model, 'post_image_credit', array('style' => 'height:50px;', 'class' => 'span12', 'placeholder' => 'Keterangan Gambar'));
?>

<?php 
/* end box Categories */
$this->endWidget();
开发者ID:beckblurry,项目名称:Yii1-Base-Core-V.Alpha.1,代码行数:20,代码来源:_formImages.php

示例14: process

 protected function process($model)
 {
     if (isset($_POST[$this->_model])) {
         $transaction = Yii::app()->db->beginTransaction();
         try {
             $model->attributes = $_POST[$this->_model];
             if ($model->save()) {
                 // create thumb with ext easyImage -> check components/helper and extensions/easyimage
                 Helper::createThumb(array('thumbDir' => Helper::rootImg('content/.thumb'), 'imageDir' => Helper::rootImg('content'), 'image' => $model->images, 'small' => array('type' => EasyImage::RESIZE_HEIGHT), 'medium' => array()));
                 $transaction->commit();
                 $message = "Well done! - You successfully";
                 Yii::app()->user->setFlash('info', $message);
                 $this->redirect(array('admin'));
             }
         } catch (Exception $e) {
             $transaction->rollBack();
             Yii::app()->user->setFlash('error', "{$e->getMessage()}");
         }
     }
 }
开发者ID:beckblurry,项目名称:Yii1-Base-Core-V.Alpha.1,代码行数:20,代码来源:TermController.php

示例15: array

<?php

if ($this->data('header_images') != '') {
    echo CHtml::Image(Helper::rootImg('content', $this->data('header_images')), $this->data('header_alt'), array('title' => $this->data('header_title'), 'width' => '100%'));
    echo "<hr>";
} else {
    echo "<h3>" . $this->data('header_title') . "</h3><hr>";
}
开发者ID:beckblurry,项目名称:Yii1-Base-Core-V.Alpha.1,代码行数:8,代码来源:index.php


注:本文中的Helper::rootImg方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。