Beispiel #1
0
 protected function renderContent()
 {
     $criteria = new CDbCriteria();
     $criteria->addCondition('status=1');
     $criteria->order = 'create_time DESC';
     $criteria->limit = 20;
     $hopam = Hopam::model()->findAll($criteria);
     /*$dataProvider = new CActiveDataProvider('Song', array(
           'pagination' => array(
               'pageSize' => Yii::app()->params['postsPerPage'],
           ),
           'criteria' => $criteria,
       ));
       $this->render('newest_song',array('songs'=>$dataProvider));*/
     echo CHtml::openTag("div", array('class' => 'title'));
     echo "Hợp Âm Mới";
     echo CHtml::closeTag("div");
     if ($hopam) {
         echo CHtml::openTag("ul");
         foreach ($hopam as $hp) {
             echo CHtml::openTag('li');
             echo CHtml::link($hp->title, array('/hopam/view', 'id' => $hp->id, "title" => Lnt::safeTitle($hp->title))) . " <span style='color:#a7a7a7'>({$hp->view})</span>";
             echo CHtml::closeTag('li');
         }
         echo CHtml::closeTag("ul");
     }
 }
Beispiel #2
0
 public function run()
 {
     $criteria = new CDbCriteria();
     $criteria->addCondition('status=1');
     if ($this->catId) {
         $criteria->addCondition('term_id=' . $this->catId);
     }
     if ($this->currentId) {
         $criteria->addCondition('id<>' . $this->currentId);
     }
     $criteria->order = 'create_time DESC';
     $criteria->limit = 20;
     $news = News::model()->findAll($criteria);
     echo CHtml::openTag("div", array('class' => 'title', 'style' => 'color: #000000;font-size: 18px;'));
     echo "Tin khác";
     echo CHtml::closeTag("div");
     if ($news) {
         echo CHtml::openTag("ul", array('style' => 'border: 1px solid #CCCCCC;
 border-radius: 4px 4px 4px 4px;
 margin: 8px 0px 0px 0px;
 padding: 10px 5px;list-style:none;'));
         foreach ($news as $n) {
             echo CHtml::openTag('li');
             echo CHtml::link($n->title, array('/news/detail', 'id' => $n->id, 'tid' => $n->term_id, 'title' => Lnt::safeTitle($n->title))) . " <span style='color:#a7a7a7'>({$n->view})</span>";
             echo CHtml::closeTag('li');
         }
         echo CHtml::closeTag("ul");
     }
 }
Beispiel #3
0
function showTitle($data)
{
    if ($data->end_time > time()) {
        echo CHtml::link($data->title, Yii::app()->createUrl("/training/class", array("id" => $data->id, "title" => Lnt::safeTitle($data->title)))) . "<br/>";
        echo "Đang tuyển sinh";
    } else {
        echo $data->title;
    }
}
Beispiel #4
0
 public function actionView()
 {
     $item = Product::model()->findByPk($_GET['id']);
     $db = Yii::app()->db;
     $sql = "SELECT * FROM {{product}}  WHERE status <>0 ORDER BY count_buy DESC LIMIT 0,8";
     $cmd = $db->createCommand($sql);
     $dataReader = $cmd->query();
     foreach ($dataReader as $ritem) {
         $ritem['url'] = $this->createUrl('/product/view', array('id' => $ritem['id'], 'title' => Lnt::safeTitle($ritem['title'])));
         $appItems[] = $ritem;
     }
     $this->render('view', array('item' => $item, 'relatedItems' => $appItems));
 }
Beispiel #5
0
function renderList($items)
{
    if ($items) {
        echo CHtml::openTag("ul");
        foreach ($items as $item) {
            echo CHtml::openTag("li");
            if ($item->end_time > time()) {
                echo CHtml::link($item->title, Yii::app()->createUrl('/training/class', array('id' => $item->id, 'title' => Lnt::safeTitle($item->title))));
            } else {
                echo $item->title;
            }
            echo CHtml::closeTag("li");
        }
        echo CHtml::closeTag("ul");
    }
}
Beispiel #6
0
 public function renderContent()
 {
     $criteria1 = new CDbCriteria(array('condition' => 'status=1'));
     $all = (int) Teacher::model()->count($criteria1);
     if ($all > 5) {
         $offset = rand(0, $all - 5);
     } else {
         $offset = rand(0, $all);
     }
     $criteria = new CDbCriteria(array('condition' => 'status=1', 'order' => 'RAND()', 'limit' => '5,' . $offset));
     //echo $all;
     $teachers = Teacher::model()->findAll($criteria);
     if ($teachers) {
         echo CHtml::openTag("ul");
         foreach ($teachers as $teacher) {
             $img = '';
             if ($teacher->picture) {
                 Yii::import('application.extensions.image.Image');
                 $thumbImage = new Image(Yii::getPathOfAlias('webroot') . $teacher->picture);
                 $img_url = $thumbImage->createThumb(70, 60);
                 /*$thumbImage->resize(70, 60, Image::WIDTH);
                   $arr = explode("/",$teacher->picture);
                   $file_name = $arr[count($arr)-1];
                   $thumb = Yii::getPathOfAlias('webroot') . '/resources/images/85x72/' . $file_name;
                   $thumbImage->save($thumb);*/
                 $img = '<img src="' . $img_url . '" />';
             }
             echo CHtml::openTag("li", array('class' => 'clearfix'));
             echo CHtml::openTag("div", array('class' => 'avatar'));
             echo CHtml::link($img, Yii::app()->createUrl('/teacher/view', array('id' => $teacher->id, 'title' => Lnt::safeTitle($teacher->name))));
             echo "<div>Giảng viên</div>";
             echo CHtml::closeTag("div");
             echo CHtml::openTag("div", array('class' => 'title'));
             echo CHtml::link($teacher->name, Yii::app()->createUrl('/teacher/view', array('id' => $teacher->id, 'title' => Lnt::safeTitle($teacher->name))));
             echo CHtml::closeTag("div");
             echo CHtml::openTag("div", array('style' => 'margin-top:10px;float:left;width:80px;height:14px;background:#ce1f46;color:#fff;padding:8px 0px;text-align:center'));
             echo "5.1232";
             echo CHtml::closeTag("div");
             echo CHtml::openTag("div", array('style' => 'float:right;text-align:left;width:127px;margin-top:10px;font-weight:bold;color:#a8a8a8;'));
             echo $teacher->videoCount . " bài giảng | " . $teacher->likeTeachersCount . " " . CHtml::ajaxLink(CHtml::image(Yii::app()->baseUrl . '/images/tim_03.jpg', 'Like', array('title' => 'Yêu thích')), Yii::app()->createUrl('/teacher/like', array('id' => $teacher->id)), array('success' => 'js:function(res){alert(res.msg);}'), array('class' => 'teacher_like'));
             echo CHtml::closeTag("div");
             echo CHtml::closeTag("li");
         }
         echo CHtml::closeTag("ul");
     }
 }
Beispiel #7
0
 protected function renderContent()
 {
     /*$items = array(
           array('label' => 'Tất cả', 'url' => array('video/index')),
           array('label' => 'Mới nhất', 'url' => array('video/list', 'filter' => 'latest')),
           array('label' => 'Xem nhiều nhất', 'url' => array('video/list', 'filter' => 'top_view')),
           array('label' => 'Bình chọn nhiều nhất', 'url' => array('video/list', 'filter' => 'top_like')),
       );*/
     $terms = Term::model()->findAll('vid = 2 AND parent = 0');
     foreach ($terms as $term) {
         $item = array('label' => $term->name, 'url' => array('video/catlist', 'catid' => $term->id, 'catname' => Lnt::safeTitle($term->name)));
         $items[] = $item;
         $subTerms = Term::model()->findAll('vid = 2 AND parent = ' . $term->id);
         if ($subTerms) {
             foreach ($subTerms as $sTerm) {
                 $items[] = array('itemOptions' => array('class' => 'sub'), 'label' => $sTerm->name, 'url' => array('video/catlist', 'catid' => $sTerm->id, 'catname' => Lnt::safeTitle($sTerm->name)));
             }
         }
     }
     echo "<div style='margin: 10px 0px;color: #000000;\n    font-weight: bold;\n    text-align: left;\n    text-transform: uppercase;'>Danh mục</div>";
     $this->widget('zii.widgets.CMenu', array('items' => $items, 'activateItems' => true));
 }
Beispiel #8
0
 /**
  * This is the default 'index' action that is invoked
  * when an action is not explicitly requested by users.
  */
 public function actionIndex()
 {
     $appItems = array();
     $db = Yii::app()->db;
     $sql = "SELECT v.id,v.title,v.image,v.link_youtube as youtube,v.view,u.user_id,u.username FROM {{video}} v INNER JOIN xf_user u ON v.user_id = u.user_id WHERE v.status = 1 ORDER BY v.id DESC LIMIT 0,4";
     $cmd = $db->createCommand($sql);
     $dataReader = $cmd->query();
     foreach ($dataReader as $item) {
         $item['url'] = $this->createUrl('/video/view', array('id' => $item['id'], 'title' => Lnt::safeTitle($item['title'])));
         $appItems[] = $item;
     }
     /*$sql2 = "SELECT s.title,s.image,s.id,s.view,s.embed_code as youtube,u.user_id,u.username FROM {{song}} s INNER JOIN xf_user u ON s.user_id = u.user_id WHERE s.status = 1 ORDER BY s.create_time DESC LIMIT 0,2";
       $cmd2 = $db->createCommand($sql2);
       $dataReader2 = $cmd2->query();
       foreach($dataReader2 as $item){
           $item['url'] = $this->createUrl('/song/view',array('id'=>$item['id'],'title'=>Lnt::safeTitle($item['title'])));
           $appItems[] = $item;
       }*/
     //var_dump($appItems);die;
     $sql2 = "SELECT s.title,s.image,s.id,s.view,s.embed_code as youtube,u.user_id,u.username FROM {{hopam}} s INNER JOIN xf_user u ON s.user_id = u.user_id WHERE s.status = 1 ORDER BY s.create_time DESC LIMIT 0,2";
     $cmd2 = $db->createCommand($sql2);
     $dataReader2 = $cmd2->query();
     foreach ($dataReader2 as $item) {
         $item['url'] = $this->createUrl('/hopam/view', array('id' => $item['id'], 'title' => Lnt::safeTitle($item['title'])));
         $appItems[] = $item;
     }
     $sql = "SELECT v.id,v.title,v.image,v.term_id,v.view,u.user_id,u.username FROM {{news}} v INNER JOIN xf_user u ON v.user_id = u.user_id WHERE v.status = 1 ORDER BY v.id DESC LIMIT 0,6";
     $cmd = $db->createCommand($sql);
     $dataReader = $cmd->query();
     $newsItems = array();
     foreach ($dataReader as $item) {
         $item['url'] = $this->createUrl('/news/detail', array('id' => $item['id'], 'title' => Lnt::safeTitle($item['title']), 'tid' => $item['term_id']));
         $newsItems[] = $item;
     }
     $this->render('index', array('appItems' => $appItems, 'newsItems' => $newsItems));
 }
Beispiel #9
0
    }
    ?>
    </div>
    <?php 
}
?>

    <?php 
if (isset($catItems) && $catItems) {
    ?>
    <h1 style="margin-top: 20px">Phân loại</h1>
    <ul class="catbox">
        <?php 
    foreach ($catItems as $thItem) {
        ?>
        <li>
            <?php 
        echo CHtml::link($thItem['title'], $this->createUrl('/product/list', array('catid' => $thItem['value'], 'title' => Lnt::safeTitle($thItem['title']))));
        ?>
        </li>
        <?php 
    }
    ?>
    </ul>
    <?php 
}
?>
</div>
<script type="text/javascript">
    $('.theloai').find('p').last().css('border', 'none');
</script>
Beispiel #10
0
    if (file_exists($path)) {
        $img = new Image($path);
        return $img->createThumb(105, 70);
    } else {
        return Lnt::getYoutubeImage($item['link_youtube']);
    }
}
if ($video) {
    $i = 1;
    foreach ($video as $item) {
        $c2 = $i % 2 == 0 ? "c2item" : "";
        $item['body'] = Lnt::limitWord($item['body'], 12);
        echo CHtml::openTag("div", array("class" => "item " . $c2));
        echo CHtml::image(Lnt::getYoutubeImage($item['link_youtube']));
        echo CHtml::openTag("div", array('class' => 'title'));
        echo CHtml::link(Lnt::limitWord($item['title'], 8), $this->createUrl('/video/view', array('id' => $item['id'], 'title' => Lnt::safeTitle($item['title']))), array('title' => $item['title']));
        echo CHtml::closeTag("div");
        echo CHtml::openTag("div", array('class' => 'body'));
        echo $item['body'];
        echo CHtml::closeTag("div");
        echo CHtml::closeTag("div");
        $i++;
    }
}
?>
    </div>
</div>
<!-- content -->
<div class="span-6 last">
    <?php 
$this->widget('BoxProfile', array('user' => $user));
Beispiel #11
0
<?php

/**
 * @var $data Video
 * @var $image Image
 */
$url = $this->createUrl('view', array('id' => $data->id, 'title' => Lnt::safeTitle($data->title)));
if ($data->image) {
    Yii::import('application.extensions.image.Image');
    //var_dump(Yii::getPathOfAlias('webroot') . '/' . $image->uri);die;
    $thumbImage = new Image(Yii::getPathOfAlias('webroot') . $data->image);
    $thumbImage->resize(110, 70, Image::AUTO);
    $arr = explode("/", $data->image);
    $file_name = $arr[count($arr) - 1];
    $dir = Yii::getPathOfAlias('webroot') . '/resources/images/110x70';
    //var_dump($dir);die;
    $thumb = $dir . '/' . $file_name;
    if (!is_dir($dir)) {
        mkdir($dir);
        chmod($dir, 0755);
    }
    $thumbImage->save($thumb);
}
?>
<div class="item">
    <?php 
if ($data->image) {
    ?>
    <div class="img">
        <a href="<?php 
    echo $url;
Beispiel #12
0
}
function hideEmail($email)
{
    $tk = substr($email, 0, strpos($email, '@'));
    $ext = substr($email, strpos($email, '@'), strlen($email));
    $len = strlen($tk) / 2;
    for ($i = $len; $i < strlen($tk); $i++) {
        $tk[$i] = "*";
    }
    return $tk . $ext;
}
function hideTel($tel)
{
    $av = strlen($tel) / 2;
    for ($i = $av; $i < strlen($tel); $i++) {
        $tel[$i] = "*";
    }
    return $tel;
}
echo "<h1 class='title'>Mã số lớp: {$classGuitar->sku}</h1>";
echo CHtml::openTag("div", array('style' => 'margin-top:12px;'));
echo "<b>" . $classGuitar->title . "</b> phụ trách bởi Giảng viên <b>" . $classGuitar->teacher . "</b>. Thời gian khóa học: <u style='color:#5AC9E7'>" . date('d/m/Y', $classGuitar->start_time) . "</u> đến <u style='color:#5AC9E7'>" . date('d/m/Y', $classGuitar->end_time) . '</u>' . ($classGuitar->end_time > time() ? " ==> " . CHtml::link("Đăng ký ngay", $this->createUrl('register', array('cid' => $classGuitar->id))) : "");
echo CHtml::closeTag("div");
$this->widget('zii.widgets.grid.CGridView', array('id' => 'center-grid', 'dataProvider' => $students, 'emptyText' => 'Chưa có học viên nào', 'summaryText' => '', 'columns' => array(array('name' => "STT", 'value' => '$row+1'), array('name' => 'name', 'value' => '$data->name', 'type' => 'html', 'htmlOptions' => array('class' => 'ctitle')), array('name' => 'birthday', 'value' => '$data->birthday', 'type' => 'html', 'htmlOptions' => array('class' => 'ctitle')), array('name' => 'create_time', 'value' => '$data->create_time', 'type' => 'html', 'htmlOptions' => array('class' => 'ctitle')), array('name' => 'pay_time', 'value' => '$data->pay_time', 'type' => 'html', 'htmlOptions' => array('class' => 'ctitle')), array('name' => 'tel', 'value' => 'hideTel($data->tel)', 'type' => 'html', 'htmlOptions' => array('class' => 'ctitle')), array('name' => 'email', 'value' => 'hideEmail($data->email)', 'type' => 'html', 'htmlOptions' => array('class' => 'ctitle')))));
if (isset($relatedClass) && $relatedClass) {
    echo "<h1 class='title'>Danh sách lớp học lưu</h1>";
    $this->widget('zii.widgets.grid.CGridView', array('id' => 'center-grid', 'dataProvider' => $relatedClass, 'emptyText' => 'Không có lớp học nào', 'summaryText' => '', 'columns' => array(array('name' => "STT", 'value' => '$data->id'), array('name' => 'sku', 'value' => '$data->sku', 'type' => 'html', 'htmlOptions' => array('class' => 'ctitle')), array('name' => 'title', 'value' => 'showTitle($data)', 'type' => 'html'), array('name' => 'Lịch học', 'value' => 'calendar($data->classCalendars)'), 'teacher', array('name' => CHtml::encode('Đã đăng ký'), 'value' => '$data->studentCount'))));
}
echo "<h1 class='title'>Địa điểm học</h1>";
echo "<p>Các lớp học khác của trung tâm xem " . CHtml::link("tại đây", $this->createUrl("center", array("id" => $classGuitar->c->id, 'title' => Lnt::safeTitle($classGuitar->c->title)))) . "</p>";
echo $classGuitar->c->body;
Beispiel #13
0
echo number_format($hopam->view, 0, '.', ',');
?>
            </div>
            <div><b><?php 
echo $hopam->likeCount;
?>
</b> yêu thích</div>
        </div>
    </div>
    <div id="share_box" class="view clearfix" style="display: none;">
        <ul>
            <li>
                <span>Link nhạc:</span>
                <input
                    value="<?php 
echo Lnt::WEB . Yii::app()->baseUrl . $this->createUrl('view', array('id' => $hopam->id, 'title' => Lnt::safeTitle($hopam->title)));
?>
"
                    class="text">
            </li>
            <li>
                <span>Nhúng:</span>
                <textarea class="text" cols="63"><?php 
echo CHtml::encode($hopam->embed_code);
?>
</textarea>
            </li>
        </ul>
    </div>
    <div class="user_info">
        <div>Người
Beispiel #14
0
<?php

/**
 * @var $data Product
 * @var $image Image
 */
$thumb = new Image(Yii::getPathOfAlias('webroot') . $data['image']);
$img_url = $thumb->createThumb(140, 195);
echo CHtml::openTag("li", array('class' => 'item'));
echo CHtml::link(CHtml::image($img_url), $this->createUrl('view', array('id' => $data['id'], 'title' => Lnt::safeTitle($data['title']))));
echo CHtml::openTag("div", array('class' => 'title'));
echo CHtml::encode($data['title']);
echo CHtml::closeTag("div");
echo CHtml::openTag("div", array('class' => 'price'));
echo CHtml::encode(number_format($data['price'], 0, ',', '.') . 'đ');
echo CHtml::closeTag("div");
echo CHtml::openTag("div", array('class' => 'body'));
echo Lnt::limitWord($data['body'], 10, ',', '.');
echo CHtml::closeTag("div");
echo CHtml::closeTag("li");
Beispiel #15
0
            /*$thumb = '/upload/images/thumb/product100/'.substr_replace($product->image,'',0,14);
            		if(!is_file(Yii::getPathOfAlias('webroot').$thumb)){
            			Yii::import('application.extensions.image.Image');
            			$image = new Image(Yii::getPathOfAlias('webroot').'/'.$product->image);
            			$image->resize(100, 100);
            			if(!is_dir(Yii::getPathOfAlias('webroot').'/upload/images/thumb/product100/')){
            				mkdir(Yii::getPathOfAlias('webroot').'/upload/images/thumb/product100/');
            				chmod(Yii::getPathOfAlias('webroot').'/upload/images/thumb/product100/',0777);
            			}
            			$image->save(Yii::getPathOfAlias('webroot').$thumb);
            		}*/
        }
        $i++;
        $img = new Image(Yii::getPathOfAlias("webroot") . $product->image);
        $img_url = $img->createThumb(70, 70);
        echo "<tr><td>{$i}</td><td><div style='float:left;border: 1px solid #CCCCCC;padding:5px;margin-right:5px;'><a href='" . $this->createUrl('product/view', array('id' => $product->id, 'title' => Lnt::safeTitle($product->title))) . "' target='_blank'><img src='" . $img_url . "' /></a></div></td><td><div>{$product->title}</div></td><td><div style='text-align:center;color:#990000;font-weight: bold;'>" . number_format($product->price * $item['count'], 0, ',', '.') . " đ</div></td><td>" . CHtml::listBox('price', $item['count'], array(1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5, 6 => 6, 7 => 7, 8 => 8, 9 => 9, 10 => 10), array('size' => 1, 'onchange' => 'updateCart(' . $product->id . ',this);')) . "</td><td>" . CHtml::ajaxLink('Xóa', $this->createUrl('remove', array('id' => $product->id)), array('success' => 'js:function(data){if(data.success){window.location.reload();}}')) . "</td></tr>";
    }
    ?>

		<tr><td colspan="3" ><?php 
    echo CHtml::link('', $this->createUrl('index'), array('id' => 'btnbackBuy'));
    ?>
<span style="float:right;font-weight: bold;">Tổng tiền:</span></td><td style="text-align:center;color:#990000;font-weight: bold;"><?php 
    echo number_format($total_price, 0, ',', '.');
    ?>
 đ</td><td colspan="2"><?php 
    echo CHtml::link("", $this->createUrl('pay'), array('id' => 'btnPay'));
    ?>
</td></tr>
		<?php 
} else {