本文整理汇总了PHP中DxdUtil::startWith方法的典型用法代码示例。如果您正苦于以下问题:PHP DxdUtil::startWith方法的具体用法?PHP DxdUtil::startWith怎么用?PHP DxdUtil::startWith使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DxdUtil
的用法示例。
在下文中一共展示了DxdUtil::startWith方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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();
}
示例2: 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;
}
示例3: actionOrder
public function actionOrder($categoryId)
{
if (isset($_POST['order'])) {
$ids = explode(",", $_POST['order']);
for ($i = 0; $i < count($ids); $i++) {
if (DxdUtil::startWith($ids[$i], 'page-')) {
$id = substr($ids[$i], 5);
$model = $this->loadModel($id);
//$model->updateByPk( $id,array("weight"=>$i+1));
$model->weight = $i + 1;
$model->save();
}
}
}
}
示例4: actionOrder
public function actionOrder($courseId)
{
$course = $this->loadCourse($courseId);
if (isset($_POST['order'])) {
// $course->orderLessons($_POST['order']);
$ids = explode(",", $_POST['order']);
for ($i = 0; $i < count($ids); $i++) {
if (DxdUtil::startWith($ids[$i], 'lesson-')) {
$id = substr($ids[$i], 7);
$lesson = Lesson::model()->findbyPk($id);
$lesson->updateByPk($id, array("weight" => $i + 1));
} else {
$id = substr($ids[$i], 8);
$chapter = Chapter::model()->findbyPk($id);
$chapter->updateByPk($id, array("weight" => $i + 1));
}
}
Chapter::model()->refreshAllNumbers($courseId);
Lesson::model()->refreshAllNumbers($courseId);
Lesson::model()->refreshAllChapterIds($courseId);
Yii::app()->end();
}
}