Esempio n. 1
0
 public function actionScrollview($text = "")
 {
     if ($text == "") {
         $query = "SELECT article_modulecomponentid FROM scrolltext WHERE page_modulecomponentid=" . $this->moduleComponentId;
         $result = mysql_query($query);
         $row = mysql_fetch_assoc($result);
         $articleid = $row['article_modulecomponentid'];
         $query = "SELECT article_content,article_lastupdated FROM article_content WHERE page_modulecomponentid=" . $articleid;
         $result = mysql_query($query);
         if ($row = mysql_fetch_assoc($result)) {
             $text = $row['article_content'];
             global $PAGELASTUPDATED;
             $PAGELASTUPDATED = $row['article_lastupdated'];
         } else {
             return "Article not yet created.";
         }
     }
     $content = "<HEAD><META HTTP-EQUIV=REFRESH CONTENT=300></HEAD><body><div><div align=\"center\"><fieldset><marquee behavior=scroll scrollAmount=\"1\" scrolldelay=\"0\" onmouseover=\"this.stop()\" direction=\"up\" onmouseout=\"this.start()\" vspce=\"800px\"style=\"height:800px;width:800px;font-size:15px;color:#880000;\">" . $text . "</div></fieldset></marquee></body>";
     global $sourceFolder;
     global $moduleFolder;
     require_once $sourceFolder . "/pngRender.class.php";
     if (get_magic_quotes_gpc()) {
         $content = stripslashes($content);
     }
     $render = new pngrender();
     echo $render->transform($content);
     disconnect();
     exit;
 }
Esempio n. 2
0
    public function actionView()
    {
        global $sourceFolder, $cmsFolder, $templateFolder, $moduleFolder, $urlRequestRoot;
        require_once "{$sourceFolder}/{$moduleFolder}/faculty/template_edit.php";
        $viewDetail = "";
        $templateId = getTemplateId($this->moduleComponentId);
        $sectionDetail = getTemplateDataFromModuleComponentId($this->moduleComponentId);
        $title = getPageTitle(getPageIdFromModuleComponentId("faculty", $this->moduleComponentId));
        $getImage = "SELECT * FROM `faculty_module` WHERE `page_moduleComponentId`={$this->moduleComponentId}";
        $getImageQuery = mysql_query($getImage);
        $isExistPh = mysql_fetch_assoc($getImageQuery);
        $viewDetail .= <<<IMG
\t    <div style="text-align:center;">
\t    <img src="{$isExistPh['photo']}" />
\t    </div>
IMG;
        require_once $sourceFolder . "/pngRender.class.php";
        $render = new pngrender();
        $emailId = getEmailForFaculty($this->moduleComponentId);
        $ret = $render->transform("[tex]" . $emailId . "[/tex]");
        $viewDetail .= "<h3 style='text-align:center;'>Email:{$ret}</h3>";
        while ($sectionDetailArray = mysql_fetch_assoc($sectionDetail)) {
            $sectionId = $sectionDetailArray['template_sectionId'];
            $printFacData = printFacultyData($sectionId, $this->moduleComponentId, 0);
            if ($printFacData != "") {
                $viewDetail .= <<<facultyName
\t\t<h2>{$sectionDetailArray['template_sectionName']}</h2><hr>
facultyName;
            }
            $viewDetail .= "<br/><br/>";
            $sectionChildNode1DetailQuery = "SELECT * FROM `faculty_template` WHERE `template_id`={$templateId} AND ";
            $sectionChildNode1DetailQuery .= "`template_sectionParentId`={$sectionDetailArray['template_sectionId']}";
            $sectionChildNode1DetailResult = mysql_query($sectionChildNode1DetailQuery);
            $viewDetail .= $printFacData;
            while ($sectionChildNode1DetailArray = mysql_fetch_assoc($sectionChildNode1DetailResult)) {
                $facultyData = printFacultyData($sectionChildNode1DetailArray['template_sectionId'], $this->moduleComponentId, 1);
                $viewDetail .= <<<facultyName
\t\t<h3>{$facultyData}</h3>
facultyName;
                $sectionChildNode2DetailQuery = "SELECT * FROM `faculty_template` WHERE `template_id`={$templateId} AND ";
                $sectionChildNode2DetailQuery .= "`template_sectionParentId`={$sectionChildNode1DetailArray['template_sectionId']}";
                $sectionChildNode2DetailResult = mysql_query($sectionChildNode2DetailQuery);
                while ($sectionChildNode2DetailArray = mysql_fetch_assoc($sectionChildNode2DetailResult)) {
                    $facultyDataChild = printFacultyData($sectionChildNode2DetailArray['template_sectionId'], $this->moduleComponentId, 1);
                    $viewDetail .= <<<facultyName
\t\t  <h4>{$facultyDataChild}</h4>
facultyName;
                }
                $viewDetail .= "<br/>";
            }
        }
        return $viewDetail;
    }
Esempio n. 3
0
/**
 * function getQuestionTableHtml:
 * displays all the questions in a given section, quiz
 * with proper formatting
 */
function getQuestionTableHtml($quizId, $sectionId)
{
    global $urlRequestRoot, $sourceFolder, $templateFolder, $cmsFolder;
    $editImage = "<img style=\"padding:0px\" src=\"{$urlRequestRoot}/{$cmsFolder}/{$templateFolder}/common/icons/16x16/apps/accessories-text-editor.png\" alt=\"Edit\" />";
    $deleteImage = "{$urlRequestRoot}/{$cmsFolder}/{$templateFolder}/common/icons/16x16/actions/edit-delete.png";
    $moveUpImage = "<img src=\"{$urlRequestRoot}/{$cmsFolder}/{$templateFolder}/common/icons/16x16/actions/go-up.png\" alt=\"Move Section Up\" />";
    $moveDownImage = "<img src=\"{$urlRequestRoot}/{$cmsFolder}/{$templateFolder}/common/icons/16x16/actions/go-down.png\" alt=\"Move Section Down\" />";
    $questionQuery = "SELECT * FROM `quiz_questions` WHERE `page_modulecomponentid` = '{$quizId}' AND `quiz_sectionid` = '{$sectionId}' ORDER BY `quiz_questionrank`";
    $questionResult = mysql_query($questionQuery);
    $questionListHtml = '<table border="1"><tr><th>Question</th><th>Type</th><th></th></tr>';
    $questionCount = mysql_num_rows($questionResult);
    $i = 0;
    while ($questionRow = mysql_fetch_assoc($questionResult)) {
        $questionId = $questionRow['quiz_questionid'];
        $rightAnswer = $questionRow['quiz_rightanswer'];
        $optionsText = '';
        $optionsQuery = "SELECT * FROM `quiz_objectiveoptions` WHERE `page_modulecomponentid` = '{$quizId}' AND `quiz_sectionid` = '{$sectionId}' AND `quiz_questionid` = '{$questionId}' ORDER BY `quiz_optionrank";
        $optionsResult = mysql_query($optionsQuery);
        $j = 1;
        while ($optionsRow = mysql_fetch_assoc($optionsResult)) {
            $style = '';
            if ($j == $rightAnswer) {
                $style = 'font-weight: bold;';
            }
            $optionsText .= "<p style=\"margin-left: 12px; {$style}\">{$optionsRow['quiz_optiontext']}</p>\n";
            ++$j;
        }
        global $sourceFolder, $moduleFolder;
        require_once $sourceFolder . "/pngRender.class.php";
        $render = new pngrender();
        $optionsText = $render->transform($optionsText);
        $questionDesc = $render->transform($questionRow['quiz_question']);
        $moveUp = $i == 0 ? '' : "<a href=\"./+edit&subaction=movequestion&direction=up&sectionid={$sectionId}&questionid={$questionId}\">{$moveUpImage}</a>";
        $moveDown = $i == $questionCount - 1 ? '' : "<a href=\"./+edit&subaction=movequestion&direction=down&sectionid={$sectionId}&questionid={$questionId}\">{$moveDownImage}</a>";
        $questionListHtml .= <<<QUESTIONROW
\t\t<tr>
\t\t\t<td>{$questionDesc}<br />{$optionsText}</td><td>{$questionRow['quiz_questiontype']}</td>
\t\t\t<td nowrap="nowrap">
\t\t\t\t<a href="./+edit&subaction=editquestion&sectionid={$sectionId}&questionid={$questionRow['quiz_questionid']}">{$editImage}</a>
\t\t\t\t<form style="display:inline;margin:0;padding:0;border:0" method="POST" action="./+edit&subaction=deletequestion">
\t\t\t\t\t<input type="hidden" name="hdnSectionId" value="{$sectionId}" />
\t\t\t\t\t<input type="hidden" name="hdnQuestionId" value="{$questionId}" />
\t\t\t\t\t<input type="image" name="btnDelete" src="{$deleteImage}" title="Delete" />
\t\t\t\t</form>
\t\t\t\t{$moveUp}
\t\t\t\t{$moveDown}
\t\t\t</td>
\t\t</tr>
QUESTIONROW;
        ++$i;
    }
    return $questionListHtml . '</table>';
}
Esempio n. 4
0
 public function actionView($text = "")
 {
     if (isset($_GET['draft']) && isset($_POST['CKEditor1'])) {
         //$query = "UPDATE `article_draft` SET `draft_content` = '" . $_POST["CKEditor1"] . "' WHERE `page_modulecomponentid` =".$this->moduleComponentId;
         $query = "SELECT MAX(draft_number) AS MAX FROM `article_draft` WHERE page_modulecomponentid ='{$this->moduleComponentId}'";
         $result = mysql_query($query);
         if (!$result) {
             displayerror(mysql_error() . "article.lib L:44");
             return;
         }
         if (mysql_num_rows($result)) {
             $drow = mysql_fetch_assoc($result);
             $draftId = $drow['MAX'] + 1;
         } else {
             $draftId = 1;
         }
         $query = "INSERT INTO `article_draft` (`page_modulecomponentid`,`draft_number`,`draft_content`,`draft_lastsaved`,`user_id`) VALUES ('" . $this->moduleComponentId . "','" . $draftId . "','" . $_POST['CKEditor1'] . "',now(),'" . $this->userId . "')";
         $result = mysql_query($query) or die(mysql_error());
         if (mysql_affected_rows() < 1) {
             displayerror("Unable to draft the article");
         }
     }
     if ($this->isCommentsEnabled() && isset($_POST['btnSubmit'])) {
         $id = mysql_fetch_array(mysql_query("SELECT MAX(`comment_id`) AS MAX FROM `article_comments`"));
         $id = $id['MAX'] + 1;
         $user = getUserName($this->userId);
         $comment = escape(safe_html($_POST['comment']));
         mysql_query("INSERT INTO `article_comments`(`comment_id`,`page_modulecomponentid`,`user`,`comment`) VALUES('{$id}','{$this->moduleComponentId}','{$user}','{$comment}')");
         if (mysql_affected_rows()) {
             displayinfo("Post successful");
         } else {
             displayerror("Error in posting comment");
         }
     }
     if ($text == "") {
         $query = "SELECT article_content,article_lastupdated FROM article_content WHERE page_modulecomponentid='" . $this->moduleComponentId . "'";
         $result = mysql_query($query);
         if ($row = mysql_fetch_assoc($result)) {
             $text = $row['article_content'];
             $text = censor_words($text);
             global $PAGELASTUPDATED;
             $PAGELASTUPDATED = $row['article_lastupdated'];
         } else {
             return "Article not yet created.";
         }
     }
     global $sourceFolder;
     global $moduleFolder;
     require_once $sourceFolder . "/pngRender.class.php";
     if (get_magic_quotes_gpc()) {
         $text = stripslashes($text);
     }
     $render = new pngrender();
     $ret = $render->transform($text);
     require_once $sourceFolder . "/googleMaps.class.php";
     $maps = new googlemaps();
     $ret = $maps->render($ret);
     if ($this->isCommentsEnabled()) {
         $comments = mysql_query("SELECT `comment_id`,`user`,`timestamp`,`comment` FROM `article_comments` WHERE `page_modulecomponentid` = '{$this->moduleComponentId}' ORDER BY `timestamp`");
         if (mysql_num_rows($comments) > 0) {
             $ret .= "<fieldset><legend>Comments</legend>";
         }
         while ($row = mysql_fetch_array($comments)) {
             $ret .= $this->renderComment($row['comment_id'], $row['user'], $row['timestamp'], censor_words($row['comment']));
         }
         if (mysql_num_rows($comments) > 0) {
             $ret .= "</fieldset>";
         }
         $ret .= $this->commentBox();
     }
     return $ret;
 }
Esempio n. 5
0
    /**
     * function formatQuestion:
     * Given a question row, return HTML for the question.
     * @param $questionRow
     * @return string Question in HTML.
     */
    private function formatQuestion($questionRow, $questionNumber = -1)
    {
        $questionType = $questionRow['quiz_questiontype'];
        if ($questionType == 'subjective') {
            $fieldName = 'txtAnswer' . $questionRow['quiz_sectionid'] . '_' . $questionRow['quiz_questionid'];
            $answer = '<textarea 
style="width:95%;height:100px;" name="' . $fieldName . '" id="' . $fieldName . '"></textarea>';
        } else {
            $optionList = getQuestionOptionList($this->quizId, $questionRow['quiz_sectionid'], $questionRow['quiz_questionid']);
            $answer = '<table class="objectivecontainer" width="100%">';
            for ($i = 0; $i < count($optionList); ++$i) {
                $fieldType = $questionType == 'sso' ? 'radio' : 'checkbox';
                $fieldName = '';
                $fieldId = '';
                if ($questionType == 'sso') {
                    $fieldName = 'optAnswer' . $questionRow['quiz_sectionid'] . '_' . $questionRow['quiz_questionid'];
                    $fieldId = $fieldName . '_' . $optionList[$i]['quiz_optionid'];
                } elseif ($questionType == 'mso') {
                    $fieldName = 'chkAnswer' . $questionRow['quiz_sectionid'] . '_' . $questionRow['quiz_questionid'] . '_' . $optionList[$i]['quiz_optionid'];
                    $fieldId = $fieldName;
                }
                $answer .= "<tr><td width=\"24\"><input type=\"{$fieldType}\" name=\"{$fieldName}\" id=\"{$fieldId}\" value=\"{$optionList[$i]['quiz_optionid']}\" /> </td><td><label for=\"{$fieldId}\"> {$optionList[$i]['quiz_optiontext']}</label></td></tr>\n";
            }
            $answer .= '</table>';
        }
        $hiddenFieldName = "hdnQuestion{$questionRow['quiz_sectionid']}_{$questionRow['quiz_questionid']}";
        $questionDesc = $questionRow['quiz_question'];
        if ($questionNumber > 0) {
            $questionDesc = $questionNumber . ') ' . $questionDesc;
        }
        global $sourceFolder, $moduleFolder;
        require_once $sourceFolder . "/pngRender.class.php";
        $render = new pngrender();
        $questionDesc = $render->transform($questionDesc);
        $answer = $render->transform($answer);
        return <<<QUESTIONFORM
\t\t\t<input type="hidden" name="{$hiddenFieldName}" id="{$hiddenFieldName}" value="" />
\t\t\t<div class="quiz_questioncontainer">
\t\t\t\t<br /><b>{$questionDesc}</b><br /><br />
\t\t\t</div>
\t\t\t<div class="quiz_answercontainer">
\t\t\t\t{$answer}
\t\t\t</div>
QUESTIONFORM;
    }