• Main Page
  • Related Pages
  • Namespaces
  • Data Structures
  • Files
  • Examples
  • File List
  • Globals

cms/modules/scrolltext.lib.php

Go to the documentation of this file.
00001 <?php
00002 if(!defined('__PRAGYAN_CMS'))
00003 { 
00004         header($_SERVER['SERVER_PROTOCOL'].' 403 Forbidden');
00005         echo "<h1>403 Forbidden<h1><h4>You are not authorized to access the page.</h4>";
00006         echo '<hr/>'.$_SERVER['SERVER_SIGNATURE'];
00007         exit(1);
00008 }
00015 class scrolltext implements module{
00016     private $userId;
00017         private $moduleComponentId;
00018         private $action;
00019         private $scrollarticle;
00020 
00021         public function getHtml($gotuid, $gotmoduleComponentId, $gotaction) {
00022                 $this->userId = $gotuid;
00023                 $this->moduleComponentId = $gotmoduleComponentId;
00024                 $this->action = $gotaction;
00025                 include "article.lib.php";
00026                 $this->scrollarticle = new article();
00027                 if ($this->action == "view")
00028                         return $this->actionView();
00029                 if ($this->action == "scrollview")
00030                         return $this->actionScrollview();
00031                 if ($this->action == "edit")
00032                         return $this->actionEdit();
00033         }
00034         
00035         public function actionScrollview($text="") {
00036                         if($text=="") {
00037                                 $query = "SELECT article_modulecomponentid FROM scrolltext WHERE page_modulecomponentid=". $this->moduleComponentId;
00038                                 $result = mysql_query($query);
00039                                 $row = mysql_fetch_assoc($result);
00040                                 $articleid=$row['article_modulecomponentid'];
00041                                 $query = "SELECT article_content,article_lastupdated FROM article_content WHERE page_modulecomponentid=" . $articleid;
00042                                 $result = mysql_query($query);
00043                                 if($row = mysql_fetch_assoc($result)) {
00044                                         $text = $row['article_content'];
00045                                         global $PAGELASTUPDATED;
00046                                         $PAGELASTUPDATED = $row['article_lastupdated'];
00047                                 }
00048                                 else return "Article not yet created.";
00049                         }
00050                $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>";
00051                         global $sourceFolder;
00052                         global $moduleFolder;
00053                         require_once($sourceFolder."/latexRender.class.php");
00054                         if (get_magic_quotes_gpc())
00055                                 $content = stripslashes($content);
00056                         $render = new latexrender();
00057                         echo $render->transform($content);
00058                         disconnect();
00059                         exit();
00060                 }
00061 
00062 public function actionEdit(){
00063 
00064                         $query = "SELECT article_modulecomponentid FROM scrolltext WHERE page_modulecomponentid=". $this->moduleComponentId;
00065                         $result = mysql_query($query);
00066                         $row = mysql_fetch_assoc($result);
00067                         $articleId=$row['article_modulecomponentid'];
00068                         return $this->scrollarticle->getHtml($this->userId,$articleId,"edit");
00069 }
00070 public function actionView(){
00071 
00072                         $query = "SELECT article_modulecomponentid FROM scrolltext WHERE page_modulecomponentid=". $this->moduleComponentId;
00073                         $result = mysql_query($query);
00074                         $row = mysql_fetch_assoc($result);
00075                         $articleId=$row['article_modulecomponentid'];
00076                         return $this->scrollarticle->getHtml($this->userId,$articleId,"view");
00077 }
00078 
00079 public function createModule($scrollId) {
00080                 include "article.lib.php";
00081                 $article = new article();
00082                 $articleId = createInstance('article');
00083                 $article->createModule($articleId);
00084                 $query=  "INSERT INTO `scrolltext` (`page_modulecomponentid` ,`article_modulecomponentid`)VALUES ('$scrollId','$articleId')";
00085                 $result = mysql_query($query) or die(mysql_error());
00086                 return true;
00087         }
00088 
00089 public function deleteModule($moduleComponentId) {
00090                 $query = "SELECT article_modulecomponentid FROM scrolltext WHERE page_modulecomponentid=". $moduleComponentId;
00091                 $result = mysql_query($query);
00092                 $row = mysql_fetch_assoc($result);
00093                 $articleId=$row['article_modulecomponentid'];
00094 
00095                 $query = "DELETE FROM `article_content` WHERE `page_modulecomponentid`=$articleId";
00096                 $result = mysql_query($query);
00097                 if ((mysql_affected_rows()) >= 1)
00098                         return true;
00099                 else
00100                         return false;
00101 
00102         }
00103         public function copyModule($moduleComponentId,$newId) {
00104                 include "article.lib.php";
00105                 $article = new article();
00106                 $articleId = createInstance('article');
00107                 $article->createModule($articleId);
00108                 $query=  "INSERT INTO `scrolltext` (`page_modulecomponentid` ,`article_modulecomponentid`)VALUES ('$newId','$articleId')";
00109                 $result = mysql_query($query) or die(mysql_error());
00110                 
00111                 $query = "SELECT article_modulecomponentid FROM scrolltext WHERE page_modulecomponentid='{$moduleComponentId}'";
00112                 $result = mysql_query($query);
00113                 if(!$result)
00114                         return false;
00115                 $row = mysql_fetch_assoc($result);
00116                 $fromId=$row['article_modulecomponentid'];
00117 
00118                 $query = "SELECT * FROM `article_content` WHERE `page_modulecomponentid`=$fromId";
00119                 $result = mysql_query($query);
00120                 if(!$result)
00121                         return false;
00122                 $content = mysql_fetch_assoc($result);
00123                 
00124                 $query = "INSERT INTO `article_content` (`page_modulecomponentid` ,`article_content`)VALUES ('$articleId', '".mysql_escape_string($content['article_content'])."')";
00125                 mysql_query($query) or displayerror(mysql_error()."scrolltext.lib L:104");
00126 
00127                 return true;
00128         }
00129 
00130 
00131 
00132 }
00133 

Generated on Mon Mar 14 2011 05:35:30 for Pragyan CMS by  doxygen 1.7.1