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


PHP DxdUtil类代码示例

本文整理汇总了PHP中DxdUtil的典型用法代码示例。如果您正苦于以下问题:PHP DxdUtil类的具体用法?PHP DxdUtil怎么用?PHP DxdUtil使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: actionSite

 public function actionSite($power = false)
 {
     $model = new SiteForm();
     $model->getSetting();
     if (isset($_POST['SiteForm'])) {
         $model->attributes = $_POST['SiteForm'];
         $uploadFile = CUploadedFile::getInstance($model, 'logo');
         if ($uploadFile !== null) {
             $uploadFileName = "logo_" . time() . '.' . $uploadFile->getExtensionName();
             if (file_exists($model->logo)) {
                 unlink(Yii::app()->basePath . "/../" . $model->logo);
             }
             if (!is_dir(Yii::app()->basePath . "/../uploads/setting/site")) {
                 DxdUtil::createFolders(Yii::app()->basePath . "/../uploads/setting/site");
             }
             $model->logo = 'uploads/setting/site/' . $uploadFileName;
             $uploadFile->saveAs(Yii::app()->basePath . "/../" . $model->logo);
         }
         //			var_dump($_POST['SiteForm']);
         if ($model->saveSetting()) {
             Yii::app()->user->setFlash('success', '保存成功!');
         } else {
             Yii::app()->user->setFlash('error', '保存失败!');
         }
     }
     if (!$power) {
         $this->render('site', array('model' => $model));
     } else {
         $this->render('power', array('model' => $model));
     }
 }
开发者ID:stan5621,项目名称:jp_edu_online,代码行数:31,代码来源:SettingController.php

示例2: actionCropFace

 /**
  * 设置用户头像设置
  * @param integer $id
  */
 public function actionCropFace($id)
 {
     $model = $this->loadModel($id);
     if ($model->face == $model->defaultFace) {
         $this->redirect(array('uploadFace', 'id' => $id));
         Yii::app()->end();
     }
     if (isset($_POST['imageId_x'])) {
         Yii::import('ext.jcrop.EJCropper');
         $jcropper = new EJCropper();
         $jcropper->thumbPath = dirname($model->face) . "/thumbs";
         if (!file_exists($jcropper->thumbPath)) {
             DxdUtil::createFolders($jcropper->thumbPath);
         }
         // get the image cropping coordinates (or implement your own method)
         $coords = $jcropper->getCoordsFromPost('imageId');
         // returns the path of the cropped image, source must be an absolute path.
         $thumbnail = $jcropper->crop($model->face, $coords);
         if ($thumbnail) {
             unlink($model->face);
             $model->face = $thumbnail;
             $model->save();
         }
         $this->redirect(array('uploadFace', 'id' => $id));
     }
     $this->render('crop_face', array('model' => $model));
 }
开发者ID:stan5621,项目名称:jp_edu_online,代码行数:31,代码来源:ManageController.php

示例3: run

 function run()
 {
     $src = $this->flashvars['src'];
     $width = $this->width . "px";
     $height = $this->height . "px";
     if (DxdUtil::endWith($src, 'flv')) {
         $type = 'video/x-flv';
     } else {
         $type = 'video/mp4';
     }
     echo "\r\n\t\t<video id='{$this->id}' class='video-js vjs-default-skin'\r\n\t\t\t  controls preload='auto' width='{$this->width}' height='{$this->height}'\r\n\t\t\t  data-setup='{}'>\r\n\t\t\t <source src='{$src}' type='{$type}' />\r\n        ";
 }
开发者ID:stan5621,项目名称:jp_edu_online,代码行数:12,代码来源:MVideoJsPlayer.php

示例4: afterSave

 public function afterSave()
 {
     $question = $this->question;
     $arrSolution = explode(',', $question->solution);
     if ($this->isCorrect) {
         if (!in_array($this->id, $arrSolution)) {
             $arrSolution[] = $this->id;
         }
     } else {
         if (in_array($this->id, $arrSolution)) {
             DxdUtil::array_remove($arrSolution, $this->id);
         }
     }
     $question->solution = implode(',', $arrSolution);
     $question->save();
 }
开发者ID:stan5621,项目名称:eduwind,代码行数:16,代码来源:Answer.php

示例5: beforeSave

 public function beforeSave()
 {
     if (!DxdUtil::startWith($this->url, 'http://') && !DxdUtil::startWith($this->url, 'https://')) {
         $this->url = 'http://' . $this->url;
     }
     if (strpos($this->url, '.swf') === false) {
         Yii::import('ext.videolink.VideoLink');
         $video = new VideoLink();
         $result = @$video->parse($this->url);
         if ($result) {
             $this->url = $result['swf'];
             $this->source = $result['source'];
             $this->title = $result['title'];
         }
     }
     return parent::beforeSave();
 }
开发者ID:stan5621,项目名称:jp_edu_online,代码行数:17,代码来源:MediaLink.php

示例6: getTopItems

 public static function getTopItems()
 {
     $navs = Nav::model()->findAll(array('order' => 'weight asc'));
     $items = array();
     foreach ($navs as $nav) {
         $item = array();
         if (DxdUtil::startWith($nav->url, 'http://') || DxdUtil::startWith($nav->url, 'https://')) {
             $item['url'] = $nav->url;
         } else {
             $item['url'] = Yii::app()->createUrl($nav->url);
         }
         if ($nav->activeRule) {
             $item['active'] = eval($nav->activeRule);
         }
         $item['label'] = $nav->title;
         $items[] = $item;
     }
     return $items;
 }
开发者ID:stan5621,项目名称:jp_edu_online,代码行数:19,代码来源:Nav.php

示例7: run

 /**
  * 关注或取消关注
  * @param unknown_type $id
  */
 public function run($id)
 {
     $model = $this->controller->loadModel($id);
     if (isset($_POST['imageId_x'])) {
         Yii::import('ext.jcrop.EJCropper');
         $jcropper = new EJCropper();
         $jcropper->thumbPath = dirname($model->{$this->attribute}) . "/thumbs";
         if (!file_exists($jcropper->thumbPath)) {
             DxdUtil::createFolders($jcropper->thumbPath);
         }
         // get the image cropping coordinates (or implement your own method)
         $coords = $jcropper->getCoordsFromPost('imageId');
         // returns the path of the cropped image, source must be an absolute path.
         $thumbnail = $jcropper->crop($model->face, $coords);
         if ($thumbnail) {
             unlink($model->face);
             $model->face = $thumbnail;
             $model->save();
         }
         $this->controller->redirect($this->returnUrl);
     }
     $this->controller->render($this->cropViewFile, array('model' => $model));
 }
开发者ID:stan5621,项目名称:jp_edu_online,代码行数:27,代码来源:CropImageAction.php

示例8: actionEnv

 /**
  * Displays a particular model.
  * @param integer $id the ID of the model to be displayed
  */
 public function actionEnv()
 {
     $privates = array();
     $privates['cache'] = DxdUtil::isWriteable(Yii::app()->basePath . "/../caches");
     $privates['upload'] = DxdUtil::isWriteable(Yii::app()->basePath . "/../uploads");
     $privates['asset'] = DxdUtil::isWriteable(Yii::app()->basePath . "/../assets");
     $privates['protected'] = DxdUtil::isWriteable(Yii::app()->basePath . "/../protected");
     $privates['theme'] = DxdUtil::isWriteable(Yii::app()->basePath . "/../themes");
     $privates['css'] = DxdUtil::isWriteable(Yii::app()->basePath . "/../css");
     $privates['js'] = DxdUtil::isWriteable(Yii::app()->basePath . "/../js");
     $exts = array();
     $exts['curl'] = function_exists('curl_init');
     $exts['gd'] = function_exists('gd_info');
     $exts['pdo_mysql'] = extension_loaded('pdo_mysql');
     $exts['mysqli'] = extension_loaded('mysqli');
     $exts['dom'] = extension_loaded('dom');
     $phpVersion = substr(PHP_VERSION, 0, 3) >= 5.2;
     $maxFileSize = floor(min(DxdUtil::return_bytes(ini_get('post_max_size')), DxdUtil::return_bytes(ini_get('upload_max_filesize')), DxdUtil::return_bytes(ini_get('memory_limit'))) / 1024 / 1024);
     $pass = true;
     foreach ($exts as $ext) {
         if (!$ext) {
             $pass = false;
         }
     }
     foreach ($privates as $item) {
         if (!$item) {
             $pass = false;
         }
     }
     if (!$phpVersion) {
         $pass = false;
     }
     if ($maxFileSize < 2) {
         $pass = false;
     }
     $this->render('env', array('privates' => $privates, 'exts' => $exts, 'pass' => $pass, 'phpVersion' => $phpVersion, 'maxFileSize' => $maxFileSize));
 }
开发者ID:stan5621,项目名称:jp_edu_online,代码行数:41,代码来源:InstallController.php

示例9: actionCropFace

 /**
  * 裁剪封面图页面和处理方法
  * @param integer $id 文章ID
  */
 public function actionCropFace($id)
 {
     $model = $this->loadModel($id);
     if (isset($_POST['imageId_x'])) {
         Yii::import('ext.jcrop.EJCropper');
         $jcropper = new EJCropper();
         $jcropper->thumbPath = $this->facePath;
         if (!file_exists($jcropper->thumbPath)) {
             DxdUtil::createFolders($jcropper->thumbPath);
         }
         $coords = $jcropper->getCoordsFromPost('imageId');
         $thumbnail = $jcropper->crop($model->face, $coords);
         if ($thumbnail) {
             $oldFace = $model->face;
             $model->face = $thumbnail;
             if ($model->save()) {
                 if ($model->face != $oldFace) {
                     @unlink($oldFace);
                 }
                 Yii::app()->user->setFlash('success', '更新成功');
                 $this->redirect(array('index'));
             } else {
                 Yii::app()->user->setFlash('error', '更新失败');
             }
         }
     }
     $this->render('crop_face', array('model' => $model));
 }
开发者ID:stan5621,项目名称:jp_edu_online,代码行数:32,代码来源:ArticleController.php

示例10: mb_substr

<li class="dxd-group-card-item" groupid="<?php 
echo $data->id;
?>
">
  <div class="thumbnail dxd-group-card">
  	<table style="width:100%">
  	<tr>
  	<td style="width:70px;vertical-align:top">
  		<?php 
$imgUrl = $data->face && DxdUtil::xImage($data->face, 60, 60) ? Yii::app()->baseUrl . "/" . DxdUtil::xImage($data->face, 60, 60) : "http://placehold.it/60x60";
?>
	    <?php 
$image = CHtml::image($imgUrl, 'image', array('style' => 'width:60px;height:60px;', 'class' => ' '));
echo CHtml::link($image, array('view', 'id' => $data->id));
?>
	</td>
	<td style="vertical-align:top">
	<div style="margin-bottom:5px">
	    <?php 
echo CHtml::link($data->name, array('view', 'id' => $data->id));
?>
		&nbsp;&nbsp;<span class="muted"><?php 
echo $data->memberCount;
?>
成员</span>
</div>
	    <div>
	    <?php 
echo mb_substr(strip_tags($data->introduction), 0, 50, 'utf8') . "...";
?>
	    </div>
开发者ID:stan5621,项目名称:jp_edu_online,代码行数:31,代码来源:_card.php

示例11: array

<?php

/* @var $this NoticeController */
/* @var $data Notice */
//$model = Course::model()->with('user')->findByPk($data['courseId']);
$model = DxdUtil::type2Model($data['objectType'])->findByPk($data['objectId']);
if (!$model) {
    return false;
}
?>


	<?php 
echo $model->user->name;
?>
申请发布<?php 
echo CHtml::link($model->name, array("/" . $data['objectType'] . "/view", 'id' => $data['objectId']));
开发者ID:stan5621,项目名称:jp_edu_online,代码行数:17,代码来源:_apply_publish_object.php

示例12: array

if ($model->file) {
    echo "已上传文件:" . $model->file->name;
}
?>
 
     	<br/><?php 
echo "最大允许上传文件" . $maxFileSize . "M";
?>
     	&nbsp;&nbsp;<?php 
echo CHtml::link('如何修改?', "http://eduwind.com/index.php?r=group/post&id=33", array('target' => '_blank'));
?>
     	-->
    
    <?php 
if ($storage == 'cloud') {
    $this->widget('ext.uploadify.MUploadify', CloudService::getInstance("uploads/uploadFile/lesson/mediaId/" . DxdUtil::randCode(32))->getUploadifySetting());
} else {
    $this->widget('ext.uploadify.MUploadify', array('name' => 'file', 'buttonText' => '选择文件', 'uploader' => $this->createUrl('lesson/uploadVideo', array('courseId' => $model->courseId)), 'auto' => true, 'onUploadSuccess' => "js:function(file, data, response) {\n\t\t\t   \t\t\t\t\tdataObj = JSON.parse(data);\n\t\t\t   \t\t\t\t\t\$('input#mediaId').val(dataObj.id);\n\t\t\t   \t\t\t\t\t\$('p#uploadFileName').html('文件“' + file.name + '”已经上传成功。<a id=\"reUpload\" href=\"javaScript:void(0)\">重新上传</a>');\n\t\t\t   \t\t\t\t\t\$('.uploadify').uploadify('settings','buttonText','再次上传');\n\t\t\t\t\t        }", 'onQueueComplete' => "js:function(queueData) {\n\t\t\t            \$('div#file').addClass('dxd-hidden');\n\t\t\t        }"));
}
echo $form->hiddenField($model, 'mediaId', array('id' => 'mediaId'));
?>
    
    <div><pre><p id="uploadFileName" class="text-center text-info">还没有选择文件</p></pre></div>
    
    </div>
    <div id="dxd-for-link" class="dxd-media-source <?php 
if ($model->mediaSource == "self") {
    echo 'dxd-hidden';
}
?>
">
开发者ID:stan5621,项目名称:jp_edu_online,代码行数:31,代码来源:_form.php

示例13: foreach

            <?php 
if ($followDataProvider->totalItemCount > 0) {
    ?>
                <div style="margin:5px 0">
                    <span style="font-weight:bold"><?php 
    echo $followDataProvider->totalItemCount;
    ?>
 </span>
                    <?php 
    echo Yii::t('app', '人关注了这个帖子');
    ?>
                </div>
                <?php 
    foreach ($follows as $follow) {
        $img = CHtml::image(Yii::app()->baseUrl . "/" . DxdUtil::xImage($follow->user->face, 45, 45), $follow->user->name, array('style' => 'width:45px;height:45px;padding-bottom:8px;'));
        echo CHtml::link($img, $follow->user->pageUrl, array('class' => 'dxd-username', 'data-userId' => $follow->userId, 'style' => 'margin-right:5px;'));
    }
    ?>
            <?php 
}
?>
        </div>
    </div>
    </div>
</div>

<style type="text/css">
.dxd-right-col{
}
</style>
开发者ID:stan5621,项目名称:eduwind,代码行数:30,代码来源:view.php

示例14: array

<div class="view">
<div class="muted lead"><?php 
echo Yii::t('app', '问题');
?>
 <?php 
echo $data->weight;
?>
</div>
<?php 
echo $data->stem;
$this->widget('booster.widgets.TbListView', array('dataProvider' => new CArrayDataProvider($data->choices), 'itemView' => '_choice_item', 'summaryText' => false));
?>
<div><?php 
echo Yii::t('app', '正确答案:');
foreach ($data->correctChoices as $item) {
    ?>
	<?php 
    echo DxdUtil::num2Alpha($item->weight) . "&nbsp;";
}
?>
</div>
<?php 
echo CHtml::link(Yii::t('app', "编辑"), array('question/update', 'id' => $data->id), array('class' => 'pull-right'));
?>
<div class="clearfix"></div>
</div>
开发者ID:stan5621,项目名称:eduwind,代码行数:26,代码来源:_question_item.php

示例15: foreach

		<div style="margin-bottom:20px">
		<?php 
if ($followDataProvider->totalItemCount > 0) {
    ?>
		<div style="margin:15px 0">
			<span style="font-weight:bold"><?php 
    echo $followDataProvider->totalItemCount;
    ?>
 </span>
			<?php 
    echo Yii::t('app', '人关注了这个帖子');
    ?>
		</div>
			<?php 
    foreach ($follows as $follow) {
        $img = CHtml::image(Yii::app()->baseUrl . "/" . DxdUtil::xImage($follow->user->face, 25, 25), $follow->user->name, array('style' => 'width:25px;height:25px;'));
        echo CHtml::link($img, $follow->user->pageUrl, array('class' => 'dxd-username', 'data-userId' => $follow->userId, 'style' => 'margin-right:5px;'));
    }
    ?>
		<?php 
}
?>
		</div>
	</div>
	</div>
</div>

<style type="text/css">
.dxd-right-col{
padding-top:40px;
}
开发者ID:stan5621,项目名称:eduwind,代码行数:31,代码来源:view.php


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