Example #1
0
function showPanelBox($app = "users", $title = "users", $badget = 12)
{
    ?>
    <div class="col-lg-3 col-xs-4">
        <div class="panel panel-info">
            <div class="panel-heading">
                <div class="row">
                    <div class="col-xs-6">
                        <i class="fa fa-comments fa-5x"></i>
                    </div>
                    <div class="col-xs-6 text-right">
                        <p class="announcement-heading">
                            <?php 
    if ($app != null) {
        echo '<a href="' . Router::buildLink($app) . '">' . $title . '</a>';
    } else {
        echo $title;
    }
    ?>
                        </p>
                        <p class="announcement-text"><?php 
    echo $badget;
    ?>
</p>
                    </div>
                </div>
            </div>              
        </div>
    </div>
    <?php 
}
 function store()
 {
     global $mainframe, $db, $user;
     $post = $_POST;
     $arr_team_table = Request::getVar('arr_team_table', null);
     $arr_team_table = json_decode($arr_team_table, true);
     $model = Tournament::getInstance();
     global $user;
     if (!$user->isSuperAdmin()) {
         YiiMessage::raseNotice("Your account not have permission to change Tournament");
         $this->redirect(Router::buildLink("gamesport", array('view' => 'tournament')));
     }
     $tourID = Request::getVar('tourID', 0);
     $db = Yii::app()->db;
     foreach ($arr_team_table as $table_num => $team_tables) {
         if (count($team_tables)) {
             $stt = 1;
             foreach ($team_tables as $teamID => $team) {
                 if ($team == null) {
                     continue;
                 }
                 if ($team['ordering'] == null or $team['ordering'] == 0) {
                     $team['ordering'] = $stt;
                 }
                 $query = "UPDATE " . TBL_GS_TEAM_REGISTER_TOUR . " SET table_num = {$table_num}" . " ,ordering = " . $team['ordering'] . " ,mdate = now()" . " ,modified_by = {$user->id}" . " WHERE tourID = {$tourID} AND teamID = {$teamID}";
                 $command = $db->createCommand($query);
                 $command->execute();
                 $stt++;
             }
         }
     }
     return true;
 }
Example #3
0
 function storeItem()
 {
     global $mainframe, $user;
     if (!$user->isSuperAdmin()) {
         YiiMessage::raseNotice("Your account not have permission to modify module");
         $this->redirect(Router::buildLink("cpanel"));
     }
     $cid = Request::getVar("id", 0);
     $obj_module = YiiModule::getInstance();
     $obj_row = $obj_module->loadItem($cid);
     $obj_row->bind($_POST);
     $menu_selected = Request::getVar('selection-menu-select', 'selected');
     $obj_row->params = json_encode($_POST['params']);
     $obj_row->menu = $menu_selected;
     $obj_row->store();
     if ($menu_selected == 'all') {
         $query = "DELETE FROM " . TBL_MODULE_MENUITEM_REF . " WHERE moduleID = {$obj_row->id} ";
         Yii::app()->db->createCommand($query)->query();
         $query = "INSERT INTO " . TBL_MODULE_MENUITEM_REF . " SET moduleID = {$obj_row->id}, menuID = 0 ";
         Yii::app()->db->createCommand($query)->query();
     } else {
         if ($menu_selected == 'selected' and isset($_POST['selection-menu'])) {
             $menuids = $_POST['selection-menu'];
             foreach ($menuids as $menuid) {
                 $query = "REPLACE INTO " . TBL_MODULE_MENUITEM_REF . " SET moduleID = {$obj_row->id}, menuID = {$menuid} ";
                 Yii::app()->db->createCommand($query)->query();
             }
         } else {
             $query = "DELETE FROM " . TBL_MODULE_MENUITEM_REF . " WHERE moduleID = {$obj_row->id} ";
             Yii::app()->db->createCommand($query)->query();
         }
     }
     return $obj_row->id;
 }
 public function actionSave()
 {
     global $mainframe, $user;
     if (!$user->isSuperAdmin()) {
         YiiMessage::raseNotice("Your account not have permission to modify setting");
         $this->redirect(Router::buildLink("cpanel"));
     }
     $post = Request::get();
     $db_info = $post['config']['database'];
     $connectionString = '\'mysql:dbname=' . $db_info['databasename'] . ';host=' . $db_info['hostname'] . '\'';
     $this->setConfig('main', 'connectionString', $connectionString, 'db', "\\s*\\,\\s*\\'errorHandler");
     $this->setConfig('main', 'username', '\'' . $db_info['username'] . '\'', 'db', "\\s*\\,\\s*\\'errorHandler");
     $this->setConfig('main', 'tablePrefix', '\'' . $db_info['prefix'] . '\'', 'db', "\\s*\\,\\s*\\'errorHandler");
     $this->setConfig('main', 'adminEmail', '\'' . $post['config']['main']['adminEmail'] . '\'', 'params');
     $this->setConfig('main', 'permission', '\'' . $post['config']['main']['permission'] . '\'', 'params');
     $this->setConfig('main', 'copyright', '\'' . $post['config']['main']['copyright'] . '\'', 'params');
     $this->writeConfig('main');
     $this->setConfig('backend', 'timeout', '\'' . $post['config']['backend']['sessionlifetime'] . '\'', 'params');
     $this->setConfig('backend', 'timeout2', '\'' . $post['config']['backend']['sessionlifetime2'] . '\'', 'params');
     $this->setConfig('backend', 'sessionName', 'md5("' . $post['config']['backend']['sessionname'] . '")', 'session');
     $this->writeConfig('backend');
     $this->setConfig('frontend', 'timeout', '\'' . $post['config']['site']['sessionlifetime'] . '\'', 'params');
     $this->setConfig('frontend', 'timeout2', '\'' . $post['config']['site']['sessionlifetime2'] . '\'', 'params');
     $this->setConfig('frontend', 'offlineMessage', '\'' . $post['config']['site']['offlinemessage'] . '\'', 'params');
     $this->setConfig('frontend', 'siteoffline', $post['config']['site']['offline'], 'params');
     $this->setConfig('frontend', 'sessionName', 'md5("' . $post['config']['site']['sessionname'] . '")', 'session');
     $this->setConfig('frontend', 'sef', '\'' . $post['config']['site']['sef'] . '\'', 'params');
     $this->setConfig('frontend', 'sef_suffix', '\'' . $post['config']['site']['sef_suffix'] . '\'', 'params');
     $this->setConfig('frontend', 'sef_urlsuffix', '\'' . $post['config']['site']['sef_urlsuffix'] . '\'', 'params');
     $this->writeConfig('frontend');
     YiiMessage::raseSuccess("Successfully saved changes config");
     //        $this->pageTitle = "Home page Display";
     $this->redirect(Router::buildLink("cpanel", array("view" => "sysconfig")));
 }
Example #5
0
 public function actionDisplay()
 {
     global $mainframe, $user;
     if (!$user->isSuperAdmin()) {
         YiiMessage::raseNotice("Your account not have permission to visit page");
         $this->redirect(Router::buildLink("cpanel"));
     }
     $this->addBarTitle("Resource <small>[manager]</small>", "user");
     $this->render('default');
 }
Example #6
0
function addSubMenuGameSportTour($view = "tournaments")
{
    global $mainframe;
    $tourID = Request::getVar('tourID', 0);
    $mainframe->addIconSubMenu("Panel", Router::buildLink('gamesport'));
    $mainframe->addIconSubMenu("Back", Router::buildLink('gamesport', array('view' => 'tournaments')));
    $mainframe->addIconSubMenu("Edit tournament", Router::buildLink('gamesport', array('view' => 'tournaments', 'layout' => 'edit', 'cid' => $tourID)));
    $mainframe->addIconSubMenu("Teams Joined", Router::buildLink('gamesport', array('view' => 'tournament', 'tourID' => $tourID)), $view == 'tournament');
    $mainframe->addIconSubMenu("Round Table", Router::buildLink('gamesport', array('view' => 'roundtable', 'tourID' => $tourID)), $view == 'roundtable');
    $mainframe->addIconSubMenu("Matches", Router::buildLink('gamesport', array('view' => 'matches', 'tourID' => $tourID)), $view == 'matches');
}
Example #7
0
 function storeItem()
 {
     global $mainframe, $user;
     if (!$user->isSuperAdmin()) {
         YiiMessage::raseNotice("Your account not have permission to modify category");
         $this->redirect(Router::buildLink("categories"));
     }
     $cid = Request::getVar("id", 0);
     $obj_item = YiiCategory::getInstance();
     $obj_item = $obj_item->loadItem($cid, "*", false);
     $obj_item->bind($_POST);
     if ($obj_item->id == 0) {
         $obj_item->created_by = $user->id;
     }
     $obj_item->modified_by = $user->id;
     $obj_item->store();
     YiiMessage::raseSuccess("Successfully save Category");
     return $obj_item->id;
 }
 function store()
 {
     global $mainframe, $db, $user;
     $tourID = Request::getVar('tourID', 0);
     $post = $_POST;
     $model = Matches::getInstance();
     global $user;
     if (!$user->isSuperAdmin()) {
         YiiMessage::raseNotice("Your account not have permission to change Tournament");
         $this->redirect(Router::buildLink("gamesport", array('view' => 'tournament')));
     }
     $tourID = Request::getVar('tourID', 0);
     $db = Yii::app()->db;
     $matches_data_table = json_decode($post['matches_data_table']);
     $matches_make_first_data = $post['matches_make_first_data'];
     if ($matches_make_first_data == 1) {
         $model->make_matches($tourID, $matches_data_table);
     }
     return true;
 }
Example #9
0
function showNodeTree($items, $level = 0)
{
    $class = $level > 1 ? "line" : "";
    echo '<ul class="' . $class . '">';
    $k = 0;
    foreach ($items as $item) {
        $_class = $k == 0 ? "first" : ($k == count($items) - 1 ? "last" : "");
        $img_type = " <img src='/images/icons/affected_{$item->affected}.png' style='height: 16px;' />";
        $str_title = '';
        $link_edit = Router::buildLink('users', array("view" => "resource", "layout" => "edit", 'cid' => $item->id));
        if ($item->status == 1) {
            $img_status = " <img src='/images/jassets/icons/tick.png' style='height: 16px;' />";
            $str_title = ' <a href="' . $link_edit . '">' . $item->title . '</a>' . $img_type . $img_status;
        } else {
            $img_status = " <img src='/images/jassets/icons/publish_x.png' style='height: 16px;' />";
            $str_title = ' <a href="' . $link_edit . '" style="text-decoration: line-through; color: #999;">' . $item->title . '</a>' . $img_type . $img_status;
        }
        if (isset($item->data_child) and count($item->data_child) > 0) {
            if ($level != 0) {
                echo '<li class="folder parent ' . $_class . '">';
                echo '<i class="folder-btn btn-open" rel=""></i>';
                echo '<input id="cb' . $item->id . '" type="checkbox" value="' . $item->id . '" name="cid[]" onclick="isChecked(this.checked);" />';
                echo $str_title;
            } else {
                echo '<li>';
                echo ' <a>' . $item->title . '</a>';
            }
            $level++;
            showNodeTree($item->data_child, $level);
            echo '</li>';
        } else {
            echo '<li class="file ' . $_class . '">';
            echo '<input id="cb' . $item->id . '" type="checkbox" value="' . $item->id . '" name="cid[]" onclick="isChecked(this.checked);" />';
            echo $str_title;
            echo '</li>';
        }
        $k++;
    }
    echo '</ul>';
}
 public function actionBlog()
 {
     $model = Video::getInstance();
     $catAlias = Request::getVar('alias', null);
     $catID = Request::getVar("id");
     $currentPage = Request::getVar('page', 1);
     $limit = 12;
     $data['alias'] = $catAlias;
     $obj_category = $model->getCategory($catID, $catAlias);
     if ($obj_category == false) {
         $this->redirect(Router::buildLink('videos'));
     }
     if ($currentPage == 1) {
         $data['items'] = $model->getItems($obj_category['id'], true, 5);
     }
     $start = ($currentPage - 1) * $limit;
     $data['items2'] = $model->getItems($obj_category['id'], false, $limit, $start);
     if ($obj_category['total'] > $start + $limit) {
         $page = $currentPage + 1;
     } else {
         $page = $currentPage - 1;
     }
     $catAlias = $obj_category['alias'];
     $params = array("view" => "category", "id" => $obj_category['id'], "alias" => $obj_category['alias'], "page" => $page);
     $obj_category['pagemore'] = Router::buildLink('videos', $params);
     $page_title = $obj_category['title'];
     if ($currentPage > 1) {
         $page_title = $page_title . " trang {$currentPage}";
     }
     $page_keyword = $obj_category['metakey'] != "" ? $obj_category['metakey'] : $page_title;
     $page_description = $obj_category['metadesc'] != "" ? $obj_category['metadesc'] : $page_title;
     setSysConfig("seopage.title", $page_title);
     setSysConfig("seopage.keyword", $page_keyword);
     setSysConfig("seopage.description", $page_description);
     $data['category'] = $obj_category;
     $this->render('blog', $data);
 }
Example #11
0
<div class="module row">
    <form action="<?php 
echo Router::buildLink("articles");
?>
" method="post" name="adminForm">
        <input type="hidden" name="id" value="<?php 
echo $item->id;
?>
"/>        
        <div class="col-md-8">
            <div class="panel panel-primary">
                <div class="panel-heading">
                    <span><b>Main content</b></span>                    
                </div>
                <div class="panel-body">
                    <?php 
echo buildHtml::renderField("label", "id", $item->id, "ID");
?>
                    <?php 
echo buildHtml::renderField("text", "title", $item->title, "Title", "form-control title-generate");
?>
                    <?php 
echo buildHtml::renderField("text", "alias", $item->alias, "Alias", "form-control alias-generate", "Auto-generate from title");
?>
                    <?php 
echo buildHtml::renderField('textarea', "introtext", $item->introtext, "Description");
?>
                    <?php 
echo buildHtml::renderField('editor', "fulltext", $item->fulltext, "Content");
?>
                </div>
 function deleteExt()
 {
     global $mainframe, $user;
     if (!$user->isSuperAdmin()) {
         YiiMessage::raseNotice("Your account not have permission to modify extension");
         $this->redirect(Router::buildLink("cpanel"));
     }
     $cid = Request::getVar('cid');
     //$cid = 1;
     $obj_ext = YiiExtensions::getInstance();
     $obj_tblExt = $obj_ext->loadExt($cid);
     if ($obj_tblExt->required == 1) {
         YiiMessage::raseNotice("System is require extention: {$obj_tblExt->name}");
         $this->redirect(Router::buildLink("installer", array('view' => 'manager')));
     }
     //neu ma app: kiem tra menu co dang su dung ext nay khong thi unpublish di
     if ($obj_tblExt->type == "app") {
         Yii::app()->db->createCommand()->update(TBL_MENU_ITEM, array('status' => 0), 'app = \'' . $obj_tblExt->folder . '\'');
     }
     //neu ma module: kiem tra co module nao duoc tao ra khong thi unpublish di
     if ($obj_tblExt->type == "module") {
         //            $obj_module = YiiModule::getInstance();
         //            $items = $obj_module->loadItems(null, 'module = \''. $obj_tblExt->folder.'\'');
         Yii::app()->db->createCommand()->update(TBL_MODULES, array('status' => 0), 'module = \'' . $obj_tblExt->folder . '\'');
     }
     //neu ma theme: thi kiem tra xem co dang la theme default khong
 }
 public function accessRules()
 {
     global $db, $user, $mainframe;
     $YiiApp = Yii::app();
     $app = Request::getVar('app', 'cpanel');
     $view = Request::getVar('view', 'cpanel');
     $layout = Request::getVar('layout', 'cpanel');
     if (is_object($user) and $user->isLogin()) {
         if (!$user->isAdmin()) {
             YiiMessage::raseWarning("Your account not have permission to visit backend page");
             Yii::app()->session['userbackend'] = null;
             $this->redirect(Router::buildLink("users", array("view" => 'user', 'layout' => 'logout')));
             //                $this->redirect(array('users/logout'));
             return;
         }
         if ($app == "users" and $view == "user" and $layout == "login") {
             $this->redirect(Router::buildLink("cpanel"));
             //                $this->redirect(array('/cpanel'));
             return;
         }
         return array();
         $return = array(array('allow', 'actions' => array("templates"), 'users' => array('*')));
         return $return;
     } else {
         if ($app == "users" and $view == "user" and $layout == "login") {
             return array(array('allow', 'actions' => array("login"), 'users' => array('*')), array('allow', 'users' => array('@')), array('deny', 'users' => array('*')));
         } else {
             $this->redirect(Router::buildLink("users", array("view" => 'user', 'layout' => 'login')));
             //            return array();
         }
     }
 }
Example #14
0
 function actionRemove()
 {
     global $user;
     $cids = Request::getVar("cid", 0);
     $obj_table = YiiTables::getInstance(TBL_VIDEOS);
     if (count($cids) > 0) {
         for ($i = 0; $i < count($cids); $i++) {
             $cid = $cids[$i];
             $obj_table->load($cid);
             if (!($bool = $user->modifyChecking($obj_table->created_by))) {
                 $obj_users = YiiUser::getInstance();
                 $item_user = $obj_users->getUser($obj_table->created_by);
                 YiiMessage::raseNotice("Your account not have permission to delete video: {$obj_table->title}");
                 $this->redirect(Router::buildLink("videos"));
                 return false;
             }
             //check item first
             $obj_table->remove($cid);
         }
     }
     YiiMessage::raseSuccess("Successfully remove Video(s)");
     $this->redirect(Router::buildLink("videos"));
 }
Example #15
0
 function logout($cid)
 {
     Yii::app()->user->logout();
     $link = Router::buildLink("users", array("view" => "user", 'layout' => 'login'));
     Yii::app()->getRequest()->redirect($link, true, 302);
 }
Example #16
0
                                    <input type="password" name="new-password" class="form-control"/>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="control-label">Nhập lại mật khẩu mới</label>
                                <div class="form-group">
                                    <input type="password" name="renew-password" class="form-control"/>
                                </div>
                            </div>
                        </div>
                        <div class="clearfix"></div>
                        <div class="form-group">
                            <div class="btn-user">
                                <button class="btn btn-block" type="submit">Thay đổi</button>
                            </div>
                        </div>
                        <input type="hidden" name="submitform" value="change pass" />
                    </form>
                </div>
            </div>
        </div>
    </div>
     
        <div class="col-md-12 input-control">
            <a href="<?php 
echo Router::buildLink('user', array('layout' => 'register'));
?>
" class="btn btn-warning btn-register">Đăng ký tài khoản mới</a>
        </div>
     
</div>
Example #17
0
<div class="">
    <form action="<?php 
echo Router::buildLink("categories", array('layout' => 'save'));
?>
" method="post" name="adminForm">
        <input type="hidden" name="id"  value="<?php 
echo $item->id;
?>
"/>
        <div class="col-md-8">
            <div class="panel panel-primary">
                <div class="panel-heading">
                    <span>Detail</span>
                </div>
                <div class="panel-body">
                    <?php 
echo buildHtml::renderField("text", "name", $item->name, "name", "form-control title-generate");
?>
                    <?php 
echo buildHtml::renderField("text", "alias", $item->alias, "Alias", "form-control alias-generate", "Auto-generate from title");
?>
                    
                    <div class="form-group row">
                        <label class="control-label left col-md-2">Feature</label>                        
                        <div class="col-md-10">
                            <select name="feature" class="">
                                <option value="1" <?php 
if ($item->feature == 1) {
    echo 'selected=""';
}
?>
Example #18
0
                            <th>Name</th>    
                            <th width="2%">level</th>    
                            <th width="5%" align="center">Status</th>
                            <th width="20%">Type</th>
                            <th width="15%">Modified</th>
                            <th width="4%">ID</th>
                        </tr>
                    </thead>
                    <tbody>
                        <?php 
if (isset($items) && $items) {
    ?>
                                
                            <?php 
    foreach ($items as $i => $item) {
        $link_edit = Router::buildLink('menus', array("view" => "menuitem", "layout" => 'edit', 'menu' => $item['menuID'], 'cid' => $item['id']));
        $item['title'] = str_repeat(" &nbsp; &nbsp; &nbsp; ", $item['level'] - 1) . " - " . $item['title'];
        $item['params'] = json_decode($item['params']);
        ?>
                                <tr>
                                    <td><?php 
        echo $i + 1;
        ?>
</td>                                        
                                    <td>
                                        <input id="cb<?php 
        echo $i;
        ?>
" type="checkbox" name="cid[]" value="<?php 
        echo $item["id"];
        ?>
Example #19
0
                        <input type="hidden" name="submitform" value="register account" />
                    </form>
                </div>
            </div>
        </div>
    </div>
    <div class="col-md-12 input-control">
        <a href="<?php 
echo Router::buildLink('user', array('layout' => 'login'));
?>
" class="btn btn-info">Đăng nhập</a>
        <a href="<?php 
echo Router::buildLink('user', array('layout' => 'forgotpass'));
?>
" class="btn btn-success">Quên mật khẩu</a>
    </div>
</div>
<script type="text/javascript">
    var link_checkuser = "******"checkuser"));
?>
";
    var link_checkcaptacha = "<?php 
echo Router::buildLink('user', array('layout' => "checkcaptcha"));
?>
";    
    var link_checkmobile = "<?php 
echo Router::buildLink('user', array('layout' => "checkmobile"));
?>
";    
</script>    
Example #20
0
function showNodeTree($items, $items_status, $all_granted, $ext_default_1, $level = 0)
{
    $class = $level > 1 ? "line" : "";
    echo '<ul class="' . $class . '">';
    $k = 0;
    foreach ($items as $item) {
        $_class = $k == 0 ? "first" : ($k == count($items) - 1 ? "last" : "");
        $img_type = " <img src='/images/icons/affected_{$item->affected}.png' style='height: 16px;' />";
        $str_title = '';
        $link_edit = Router::buildLink('users', array("view" => "resource", "layout" => "edit", 'cid' => $item->id));
        $ck = -1;
        if (count($all_granted)) {
            if (isset($all_granted['allow'][$item->id])) {
                $ck = 1;
            } else {
                if (isset($all_granted['deny'][$item->id])) {
                    $ck = 0;
                }
            }
        }
        //        var_dump($ext_default_1); die;
        $_items_status = $items_status;
        if (in_array($item->app, $ext_default_1)) {
            $_items_status[0][2] = "success";
        }
        $btn = buildHtml::showBtnGroup('resource-' . $item->id, $_items_status, $ck);
        if ($item->status == 1) {
            $img_status = " <img src='/images/jassets/icons/tick.png' style='height: 16px;' />";
            $str_title = ' <a href="' . $link_edit . '">' . $item->title . '</a>' . $img_type . $img_status . $btn;
        } else {
            $img_status = " <img src='/images/jassets/icons/publish_x.png' style='height: 16px;' />";
            $str_title = ' <a href="' . $link_edit . '" style="text-decoration: line-through; color: #999;">' . $item->title . '</a>' . $img_type . $img_status . $btn;
        }
        if (isset($item->data_child) and count($item->data_child) > 0) {
            if ($level != 0) {
                echo '<li class="folder parent ' . $_class . '">';
                echo '<i class="folder-btn btn-open" rel=""></i>';
                echo $str_title;
            } else {
                echo '<li>';
                echo ' <a>' . $item->title . '</a>';
            }
            $level++;
            showNodeTree($item->data_child, $items_status, $all_granted, $ext_default_1, $level);
            echo '</li>';
        } else {
            echo '<li class="file ' . $_class . '">';
            echo $str_title;
            echo '</li>';
        }
        $k++;
    }
    echo '</ul>';
}
Example #21
0
 public function actionUploadext()
 {
     global $mainframe, $user;
     if (!$user->isSuperAdmin()) {
         YiiMessage::raseNotice("Your account not have permission to install extension");
         $this->redirect(Router::buildLink("cpanel"));
     }
     $pack_install = $_FILES['install_package'];
     if ($pack_install == null or $pack_install['error'] != 0) {
         YiiMessage::raseWarning("Unable to find install package");
         $this->redirect(Router::buildLink("installer"));
     }
     // $YiiFile = new YiiFile;
     $path_file_pach_install = PATH_TMP . $pack_install['name'];
     YiiFile::upload($pack_install['tmp_name'], $path_file_pach_install);
     $file_info = pathinfo($path_file_pach_install);
     if (strtolower($file_info['extension']) != "zip") {
         YiiMessage::raseWarning("Invalid extension install package");
         YiiFile::delete($path_file_pach_install);
         $this->redirect(Router::buildLink("installer"));
     }
     $filename = $file_info['filename'];
     $zip = new ZipArchive();
     $res = $zip->open($path_file_pach_install);
     $path_extact = PATH_TMP . $filename;
     if ($res === TRUE) {
         $zip->extractTo($path_extact);
         $zip->close();
     } else {
         YiiMessage::raseWarning("Invalid extract file install package");
         YiiFile::delete($path_file_pach_install);
         $this->redirect(Router::buildLink("installer"));
     }
     $files_xml = YiiFolder::files($path_extact, "\\.xml", 1, true);
     if (count($files_xml) == 0) {
         YiiFile::delete($path_file_pach_install);
         YiiFolder::delete($path_extact);
         YiiMessage::raseWarning("Invalid extension install package");
         $this->redirect(Router::buildLink("installer"));
     }
     $xml = null;
     foreach ($files_xml as $file_xml) {
         $xml = simplexml_load_file($file_xml);
         if (!$xml) {
             unset($xml);
             continue;
         }
         if ($xml->getName() != 'extension') {
             unset($xml);
             continue;
         }
         $type = (string) $xml->attributes()->type;
         if (!in_array($type, array("app", "module"))) {
             unset($xml);
             continue;
         }
     }
     $type = (string) $xml->attributes()->type;
     $row_ext = YiiTables::getInstance(TBL_EXTENSIONS);
     $arr_info = array();
     $arr_info['title'] = (string) $xml->title;
     $arr_info['name'] = (string) $xml->name;
     $arr_info['alias'] = $this->convertalias($arr_info['title']);
     $arr_info['author'] = (string) $xml->author;
     $arr_info['version'] = (string) $xml->version;
     $arr_info['creationDate'] = (string) $xml->creationDate;
     $arr_info['description'] = (string) $xml->description;
     $arr_info['type'] = (string) $xml->attributes()->type;
     $arr_info['folder'] = trim(preg_replace('/[^\\w\\d]+/is', '', $row_ext->title));
     $arr_info['client'] = (string) $xml->attributes()->client;
     if ($arr_info['client'] == "") {
         $arr_info['client'] = 1;
     }
     $row_ext->loadRow("*", "title = '" . $arr_info['title'] . "' OR alias = '" . $arr_info['alias'] . "'");
     $ext_new = false;
     if ($row_ext->id == 0) {
         $row_ext->cdate = date("Y-m-d H:i:s");
         $ext_new = true;
     }
     $row_ext->mdate = date("Y-m-d H:i:s");
     $row_ext->bind($arr_info);
     $path_ext = PATH_MODULES . $row_ext->folder;
     if ($row_ext->type == "app" and $row_ext->client == 1) {
         $path_ext = PATH_APPS_FRONT . $row_ext->folder;
     } else {
         if ($row_ext->type == "app" and $row_ext->client == 0) {
             $path_ext = PATH_APPS_BACKEND . $row_ext->folder;
         }
     }
     if (!YiiFolder::create($path_ext, 0775)) {
         YiiMessage::raseWarning("FILESYSTEM ERROR Could not create directory");
         YiiFile::delete($path_file_pach_install);
         YiiFolder::delete($path_extact);
         $this->redirect(Router::buildLink("installer"));
     }
     $bool = YiiFolder::copy($path_extact, $path_ext, '', 1);
     if ($row_ext->type == "module" and $ext_new == true) {
         $row_module = YiiTables::getInstance(TBL_MODULES);
         $row_module->title = $row_ext->title;
         $row_module->alias = $row_ext->alias;
         $row_module->cdate = date("Y-m-d H:i:s");
         $row_module->mdate = date("Y-m-d H:i:s");
         $row_module->module = $row_ext->folder;
         $row_module->status = 0;
         $row_module->store();
     }
     YiiFile::delete($path_file_pach_install);
     YiiFolder::delete($path_extact);
     $this->redirect(Router::buildLink("installer"), "Succesfully install package");
 }
 function actionRemove()
 {
     global $mainframe, $user;
     if (!$user->isSuperAdmin()) {
         YiiMessage::raseNotice("Your account not have permission to remove menu item");
         $this->redirect(Router::buildLink("menus", array("view" => 'menutype')));
     }
     $menuID = Request::getInt('menu', "");
     $cids = Request::getVar("cid", 0);
     $table_menu = YiiTables::getInstance(TBL_MENU_ITEM);
     if (count($cids) > 0) {
         for ($i = 0; $i < count($cids); $i++) {
             $cid = $cids[$i];
             //check item first
             $table_menu->remove($cid);
         }
     }
     YiiMessage::raseSuccess("Successfully remove Menuitem(s)");
     $this->redirect(Router::buildLink('menus', array("view" => "menuitem", 'menu' => $menuID)));
 }
Example #23
0
 function getVideoCategoy($catID, $start = 0, $limit = 10)
 {
     global $mainframe, $db;
     $list_ids = getListObjectID("videos");
     $where = array();
     $where[] = "A.status = 1";
     $where[] = "B.status = 1";
     $where[] = "A.catID = {$catID} ";
     if ($list_ids != false and $list_ids != "") {
         $where[] = "A.id not in({$list_ids})";
     }
     $where = implode(" AND ", $where);
     $query = "SELECT A.*, B.alias cat_alias, B.title cat_title " . "FROM " . TBL_VIDEOS . " A LEFT JOIN " . TBL_CATEGORIES . " B ON A.catID = B.id " . " WHERE  {$where} " . " ORDER BY A.cdate DESC LIMIT {$start}, {$limit}";
     $query_command = $db->createCommand($query);
     $items = $query_command->queryAll();
     if (count($items)) {
         foreach ($items as &$item) {
             $params = array("view" => "detail", "id" => $item['id'], "alias" => $item['alias'], "catID" => $item['catID'], "cat_alias" => $item['cat_alias']);
             $item['link'] = Router::buildLink('videos', $params);
             addObjectID($item['id'], "video");
         }
     }
     return $items;
 }
Example #24
0
 function actionRemove()
 {
     global $user;
     $model = new Group();
     $mode_user = new Users();
     if (!$user->isSuperAdmin()) {
         YiiMessage::raseNotice("Your account not have permission to add/edit group");
         $this->redirect(Router::buildLink("users", array('view' => 'group')));
     }
     $cids = Request::getVar("cid", 0);
     if (count($cids) > 0) {
         $obj_table = YiiUser::getInstance();
         for ($i = 0; $i < count($cids); $i++) {
             $cid = $cids[$i];
             $list_user = $mode_user->getUsers($cid, null, true);
             $list_group = $model->getItems($cid);
             if (empty($list_user) and empty($list_group)) {
                 $obj_table->removeGroup($cid);
             } else {
                 YiiMessage::raseNotice("Group user have something account/sub group");
                 $this->redirect(Router::buildLink("users", array('view' => 'group')));
                 return false;
             }
         }
     }
     YiiMessage::raseSuccess("Successfully delete GroupUser(s)");
     $this->redirect(Router::buildLink("users", array("view" => "group")));
 }
Example #25
0
 function actionSave()
 {
     $cid = $this->store();
     YiiMessage::raseSuccess("Successfully save Grant user");
     $this->redirect(Router::buildLink("permission", array('view' => 'users')));
 }
Example #26
0
                                <th width="5%">Items</th>
                                <th width="5%" align="center">Status</th>
                                <th width="30%">Description</th>
                                <th width="15%">Modified</th>
                                <th width="5%">ID</th>
                            </tr>
                        </thead>
                        <tbody>
                            <?php 
if (isset($items) && $items) {
    ?>
                                
                                <?php 
    foreach ($items as $i => $item) {
        $link_edit = Router::buildLink('menus', array("view" => "menutype", 'layout' => 'edit', "cid" => $item['id']));
        $link_items = Router::buildLink('menus', array("view" => "menuitem", 'menu' => $item['id']));
        ?>
                                    <tr>
                                        <td><?php 
        echo $i + 1;
        ?>
</td>                                        
                                        <td>
                                            <input id="cb<?php 
        echo $i;
        ?>
" type="checkbox" name="cid[]" value="<?php 
        echo $item["id"];
        ?>
" onclick="isChecked(this.checked);">                                            
                                        </td>
Example #27
0
            <div class="panel-heading">
                <span><b>Select a Module Type </b></span>
            </div>
            <div class="panel-body"> 
                <table class="table table-bordered table-hover table-striped ">
                    <tr>
                        <th width="2%"># </th>
                        <th>Name</th>    
                        <th width="25%" align="center">Author</th>
                        <th width="10%">Version</th>
                        <th width="15%">Created Date</th>
                    </tr>
                    <?php 
if (count($items)) {
    foreach ($items as $k => $item) {
        $link_edit = Router::buildLink('modules', array("layout" => 'addModule', 'cid' => $item['id']));
        echo '<tr onClick="">';
        echo '<td>';
        echo $k + 1;
        echo '</td>';
        echo '<td> <b> <a href="' . $link_edit . '">';
        echo $item['title'];
        echo '</a></b></td>';
        echo '<td>';
        echo $item['author'];
        echo '</td>';
        echo '<td>';
        echo $item['version'];
        echo '</td>';
        echo '<td>';
        echo $item['creationDate'];
Example #28
0
                                                </div>
                                            </div>
                                             
                                        <?php 
    }
    ?>
                                    </div>
                                </div>
                            </div>
                        </div>
                </div>
            </div>
    <?php 
}
?>
<div class="page-home">
    <?php 
foreach ($items_videos as $category) {
    ?>
        <?php 
    showBlockHome($category['videos'], $category['title'], $category['link']);
    ?>
    <?php 
}
?>
    <?php 
showBlockHome($items_news, "Tin tức", Router::buildLink('articles'), "tintuc");
?>
</div>
       
     
Example #29
0
                </a>
            </div>
            
            <div class="icon">
                <a href="<?php 
echo Router::buildLink('users', array("view" => 'settings'));
?>
">
                    <img alt="Resource" src="/images/icons/setting.png">					
                    <span>Settings</span>
                </a>
            </div> 
            
            <div class="icon">
                <a href="<?php 
echo Router::buildLink('users', array("view" => 'about'));
?>
">
                    <img alt="Role" src="/images/icons/about.png">					
                    <span>About</span>
                </a>
            </div>
        </div>
    </div>
    <div class="panel-footer">
         <pre style="font-size: 16px;">
            <b>Resource:</b> Defined all resource need manage and grant permission for account
            <b>Grant Users:</b> Grant permission for user
            <b>Grant Groups:</b> Grant permission for group            
        </pre>
    </div>
Example #30
0
echo count($items);
?>
);" value="" name="toggle"> </th>
                            <th class="title"> <a>Name</a></th>
                            <th class="title" width="3%"> <a>Status</a></th>
                            <th class="title" width="10%"> <a>Position</a></th>                
                            <th class="title" width="10%"> <a>Type</a></th>                
                            <th class="title" width="10%"> <a>Pages</a></th>
                            <th class="title"  width="3%"> <a>ID</a></th>
                        </tr>
                    </thead>
                    <tbody>
                        <?php 
$k = 0;
foreach ($items as $i => $item) {
    $link_edit = Router::buildLink("modules", array("layout" => "edit", 'cid' => $item['id']));
    ?>
                            <tr class="row1">
                                <td><?php 
    echo $i + 1;
    ?>
</td>
                                <td><input type="checkbox" onclick="isChecked(this.checked);" value="<?php 
    echo $item['id'];
    ?>
" name="cid[]" id="cb<?php 
    echo $i;
    ?>
"></td>
                                <td><a href="<?php 
    echo $link_edit;