function moda()
 {
     $clang = Yii::app()->lang;
     if (!Permission::model()->hasGlobalPermission('panellist', 'update')) {
         Yii::app()->setFlashMessage($clang->gT("You do not have sufficient rights to access this page."), 'error');
         $this->getController()->redirect(array("admin/index"));
     }
     App()->getClientScript()->registerCssFile(Yii::app()->getConfig('styleurl') . "jquery.dataTables.css");
     App()->getClientScript()->registerScriptFile(Yii::app()->getConfig('adminscripts') . 'jquery.dataTables.min.js');
     $clang = Yii::app()->lang;
     $action = isset($_POST['action']) ? $_POST['action'] : '';
     $aData = array();
     $aViewUrls = array();
     if (Permission::model()->hasGlobalPermission('', 'create')) {
         if ($action == "editanswer") {
             // Project details
             $answer_id = (int) Yii::app()->request->getPost("answer_id");
             $title = flattenText($_POST['answer_title'], false, true, 'UTF-8', true);
             $IsActive = flattenText(Yii::app()->request->getPost("IsActive"));
             $is_active = 0;
             if ($IsActive) {
                 $is_active = 1;
             }
             $sort_order = flattenText($_POST['sort_order'], false, true, 'UTF-8', true);
             if ($title == '') {
                 $aViewUrls['message'] = array('title' => $clang->gT("Failed to Add Answer"), 'message' => $clang->gT("Answer Name is invalid."), 'class' => 'warningheader');
             } else {
                 $oUser = answers::model()->findByPk($answer_id);
                 $oUser->title = $title;
                 $oUser->IsActive = $is_active;
                 $oUser->sorder = $sort_order;
                 $oUser->modified_date = Date('y-m-d h:i:s');
                 $NewAnswer = $oUser->save();
                 if ($NewAnswer) {
                     Yii::app()->setFlashMessage($clang->gT("Profile Answer Updated successfully"));
                     //$this->getController()->redirect(array("admin/profilequestion/sa/mod"));
                     $aData['row'] = 0;
                     $aData['usr_arr'] = array();
                     // Project detail
                     $question_id = (int) Yii::app()->request->getPost("question_id");
                     $action = Yii::app()->request->getPost("action");
                     $sresult = profilequestionview($question_id);
                     // only use in view_editcompany
                     $aData['question_id'] = $question_id;
                     $aData['mur'] = $sresult;
                     $aData['imageurl'] = Yii::app()->getConfig("adminimageurl");
                     $answerlist = profileanswerview($question_id, 0, 1);
                     $aData['answer_arr'] = $answerlist;
                     $this->getController()->redirect(array("admin/profilequestion/sa/mod/action/modifyquestion/question_id/{$question_id}"));
                     //$this->_renderWrappedTemplate('panellist/questions', 'editquestion_view', $aData);
                     return;
                 }
             }
         } else {
             if (isset($_POST['answer_id'])) {
                 $aData['row'] = 0;
                 $aData['usr_arr'] = array();
                 // Project detail
                 $answer_id = (int) Yii::app()->request->getPost("answer_id");
                 $action = Yii::app()->request->getPost("action");
                 $sresult = profileanswerview(0, $answer_id);
                 // only use in view_editcompany
                 $aData['answer_id'] = $answer_id;
                 $aData['mur'] = $sresult;
                 $aData['imageurl'] = Yii::app()->getConfig("adminimageurl");
                 $this->_renderWrappedTemplate('panellist/questions', 'editanswer_view', $aData);
                 return;
             }
         }
     }
     Yii::app()->setFlashMessage(Yii::app()->lang->gT("You do not have sufficient rights to access this page."), 'error');
     $this->getController()->redirect(array("admin/profilequestion/index"));
 }
Example #2
0
// +----------------------------------------------------------------------
// | Demila [ Beautiful Digital Content Trading System ]
// +----------------------------------------------------------------------
// | Copyright (c) 2015 http://demila.org All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Email author@demila.org
// +----------------------------------------------------------------------
_setView(__FILE__);
_setTitle($langArray['add'] . ' ' . $langArray['answer']);
if (!isset($_GET['id']) && !is_numeric($_GET['id'])) {
    refresh("/" . $languageURL . adminURL . "/?m=" . $_GET['m'] . "&c=list");
}
$cms = new answers();
if (isset($_POST['add'])) {
    $_POST['quiz_id'] = $_GET['id'];
    $status = $cms->add();
    if ($status !== true) {
        abr('error', $status);
    } else {
        refresh("?m=" . $_GET['m'] . "&c=answers&id=" . $_GET['id'], $langArray['add_complete']);
    }
} else {
    $_POST['visible'] = 'true';
}
$categoriesClass = new quiz();
$pdata = $categoriesClass->get($_GET['id']);
abr('pdata', $pdata);
require_once ROOT_PATH . '/apps/lists/leftlist_admin.php';
Example #3
0
// | Demila [ Beautiful Digital Content Trading System ]
// +----------------------------------------------------------------------
// | Copyright (c) 2015 http://demila.org All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Email author@demila.org
// +----------------------------------------------------------------------
_setView(ROOT_PATH . "/apps/" . $_GET['m'] . "/admin/addAnswer.php");
_setTitle($langArray['edit'] . ' ' . $langArray['answer']);
if (!isset($_GET['id']) && !is_numeric($_GET['id'])) {
    refresh("/" . $languageURL . adminURL . "/?m=" . $_GET['m'] . "&c=list", 'INVALID ID', 'error');
}
if (!isset($_GET['fid']) || !is_numeric($_GET['fid'])) {
    refresh('?m=' . $_GET['m'] . '&c=files&id=' . $_GET['id'], 'INVALID ID', 'error');
}
$cms = new answers();
if (isset($_POST['edit'])) {
    $status = $cms->edit($_GET['fid']);
    if ($status !== true) {
        abr('error', $status);
    } else {
        refresh("?m=" . $_GET['m'] . "&c=answers&id=" . $_GET['id'], $langArray['edit_complete']);
    }
} else {
    $_POST = $cms->get($_GET['fid']);
}
$categoriesClass = new quiz();
$pdata = $categoriesClass->get($_GET['id']);
abr('pdata', $pdata);
require_once ROOT_PATH . '/apps/lists/leftlist_admin.php';
Example #4
0
// +----------------------------------------------------------------------
// | Demila [ Beautiful Digital Content Trading System ]
// +----------------------------------------------------------------------
// | Copyright (c) 2015 http://demila.org All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Email author@demila.org
// +----------------------------------------------------------------------
_setView(__FILE__);
if (!check_login_bool()) {
    refresh('/' . $languageURL . 'sign_in/');
}
$quizClass = new quiz();
$answersClass = new answers();
$questions = $quizClass->getAll(0, 0, '', 'RAND()');
abr('questions', $questions);
$answers = $answersClass->getAll(0, 0, '', true);
abr('answers', $answers);
if ($_SESSION['user']['quiz'] != 'false') {
    refresh('/' . $languageURL . 'author_dashboard/');
}
#检查测验
if (isset($_POST['submit'])) {
    $rightAnswers = 0;
    if (isset($_POST['answers']) && is_array($_POST['answers'])) {
        foreach ($_POST['answers'] as $question => $answer) {
            if (isset($answers[$question][$answer]) && $answers[$question][$answer]['right'] == 'true') {
                $rightAnswers++;
            }
Example #5
0
<?php

// +----------------------------------------------------------------------
// | Demila [ Beautiful Digital Content Trading System ]
// +----------------------------------------------------------------------
// | Copyright (c) 2015 http://demila.org All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Email author@demila.org
// +----------------------------------------------------------------------
define('USING_LANGUAGE', false);
require_once '../../../config.php';
require_once $config['root_path'] . '/core/functions.php';
include_once $config['system_core'] . "/initEngine.php";
admin_login();
if (isset($_POST['delete']) && isset($_POST['id']) && isset($_SESSION['user']['access']['quiz'])) {
    require_once ROOT_PATH . "/apps/quiz/models/quiz.class.php";
    $cms = new quiz();
    $cms->delete(intval($_POST['id']));
    die(json_encode(array_merge($_POST, array('status' => 'true'))));
} elseif (isset($_POST['deleteAnswer']) && isset($_POST['id']) && isset($_SESSION['user']['access']['quiz'])) {
    require_once ROOT_PATH . "/apps/quiz/models/answers.class.php";
    $cms = new answers();
    $cms->delete(intval($_POST['id']));
    die(json_encode(array_merge($_POST, array('status' => 'true'))));
}
echo json_encode(array_merge($_POST, array('status' => 'unknown error')));
die;
function fetch_ans($url)
{
    global $current_file;
    global $source_machine;
    global $spell_checked;
    global $source_id, $fetchFromOutside, $newResult, $lastResult;
    $title = substr($url, 29);
    $query = "select * from data_ans where title = '" . mysql_real_escape_string($title) . "'";
    $result = mysql_query($query) or trigger_error(mysql_error() . " in {$query}", E_USER_ERROR);
    if (mysql_num_rows($result) && !$fetchFromOutside) {
        $row = mysql_fetch_array($result);
        $source_id = $row['id'];
        $ans_return = $row['ans'];
    } else {
        require_once 'class.answers.php';
        $out = new answers($url);
        $ans_return = $out->getdata();
        if ($ans_return) {
            if (mysql_num_rows($result)) {
                $source_id = $row['id'];
                $str = substr($ans_return, 0, 500);
                $newResult = str2hex($str);
                if ($newResult != $lastResult) {
                    $query = "update data_ans set ans='" . mysql_real_escape_string($ans_return) . "' where id=" . $source_id;
                    mysql_query($query) or trigger_error(mysql_error() . " in {$query}", E_USER_ERROR);
                }
            } else {
                $query = "insert into data_ans(title,ans) values('" . mysql_real_escape_string($title) . "','" . mysql_real_escape_string($ans_return) . "')";
                mysql_query($query) or trigger_error(mysql_error() . " in {$query}", E_USER_ERROR);
                $source_id = mysql_insert_id();
            }
        }
    }
    $current_file = "data_ans/ans/id/{$source_id}";
    $source_machine = "db";
    return $ans_return;
}
Example #7
0
<?php

// +----------------------------------------------------------------------
// | Demila [ Beautiful Digital Content Trading System ]
// +----------------------------------------------------------------------
// | Copyright (c) 2015 http://demila.org All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Email author@demila.org
// +----------------------------------------------------------------------
_setView(__FILE__);
_setTitle($langArray['answers']);
if (!isset($_GET['id']) && !is_numeric($_GET['id'])) {
    refresh("/" . $languageURL . adminURL . "/?m=" . $_GET['m'] . "&c=list");
}
$cms = new answers();
$data = $cms->getAll(START, LIMIT, " `quiz_id` = '" . intval($_GET['id']) . "' ");
abr('data', $data);
$p = paging("?m=" . $_GET['m'] . "&c=answers&id=" . $_GET['id'] . "&p=", "", PAGE, LIMIT, $cms->foundRows);
abr('paging', $p);
$categoriesClass = new quiz();
$pdata = $categoriesClass->get($_GET['id']);
abr('pdata', $pdata);
require_once ROOT_PATH . '/apps/lists/leftlist_admin.php';