|
From: <wen...@us...> - 2003-10-17 21:18:35
|
Update of /cvsroot/phpwebsite-comm/modules/rssfeeds/class
In directory sc8-pr-cvs1:/tmp/cvs-serv5117/class
Modified Files:
RSS.php RSSManager.php
Log Message:
0.1.0 Changes
Index: RSS.php
===================================================================
RCS file: /cvsroot/phpwebsite-comm/modules/rssfeeds/class/RSS.php,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** RSS.php 26 Sep 2003 21:07:47 -0000 1.3
--- RSS.php 17 Oct 2003 21:17:46 -0000 1.4
***************
*** 91,97 ****
--- 91,110 ----
/**
+ * list of modules needing to be active for menu to appear
+ * @var array
+ */
+ var $allow_view;
+
+ /**
+ * list of modules needing to be active for menu to appear
+ * @var array
+ */
+ var $pm_allow;
+
+ /**
* channel variables
* @var string
*/
+
var $channel_title;
var $channel_link;
***************
*** 113,117 ****
function RSS($rss_id = NULL) {
/* These vars are excluded on commit() */
! $exclude = array("channel_title","channel_link","channel_desc",
"channel_copy","channel_item_title","channel_item_desc",
"channel_item_author","channel_item_link","channel_image");
--- 126,130 ----
function RSS($rss_id = NULL) {
/* These vars are excluded on commit() */
! $exclude = array("channel_title","channel_link",
"channel_copy","channel_item_title","channel_item_desc",
"channel_item_author","channel_item_link","channel_image");
***************
*** 199,204 ****
$form->setMatch("BLOCK", $this->_block);
$form->setTab("BLOCK", 11);
!
! $form->add("SUBMIT_BUTTON", "submit", $this->getId() ? $_SESSION["translate"]->it("Update") : $_SESSION["translate"]->it("Save"));
$form->add("module", "hidden", "rssfeeds");
$form->add("CACHED", "hidden", date("Y-m-d G:i:s"));
--- 212,233 ----
$form->setMatch("BLOCK", $this->_block);
$form->setTab("BLOCK", 11);
!
! $form->add("ALLOW_VIEW","multiple",$this->get_modules_allowed());
! if(is_array($this->allow_view))
! $form->setMatch("ALLOW_VIEW",$this->allow_view,FALSE);
! $form->setTab("ALLOW_VIEW",12);
!
! if($GLOBALS['core']->moduleExists("pagemaster")) {
! $pages = $this->getPMOptions();
! if (is_array($pages)){
! $form->add("PM_ALLOW","multiple",$pages);
! $form->setTab("PM_ALLOW",13);
! if(is_array($this->pm_allow))
! $form->setMatch("PM_ALLOW",$this->pm_allow,FALSE);
! }
! }
!
! $form->add("SUBMIT_BUTTON", "submit", $this->getId() ? $_SESSION["translate"]->it("Update")
! : $_SESSION["translate"]->it("Save"));
$form->add("module", "hidden", "rssfeeds");
$form->add("CACHED", "hidden", date("Y-m-d G:i:s"));
***************
*** 208,215 ****
$tags = $form->getTemplate();
! // include category selection menu, with help
! $tags["CATEGORY"] = $_SESSION['OBJ_fatcat']->showSelect($this->getId(), "multiple", 3, "rssfeeds");
! $tags["CATEGORY_HELP"] = $_SESSION['OBJ_help']->show_link("rssfeeds", "rssCategory");
! $tags["CATEGORY_LABEL"] = $_SESSION['translate']->it("Category");
// vary title for new and edited listings
--- 237,246 ----
$tags = $form->getTemplate();
! // include category selection menu, with help if fatcat exists
! if($GLOBALS['core']->moduleExists("fatcat")) {
! $tags["CATEGORY"] = $_SESSION['OBJ_fatcat']->showSelect($this->getId(), "multiple", 3, "rssfeeds");
! $tags["CATEGORY_HELP"] = $_SESSION['OBJ_help']->show_link("rssfeeds", "rssCategory");
! $tags["CATEGORY_LABEL"] = $_SESSION['translate']->it("Category");
! }
// vary title for new and edited listings
***************
*** 240,243 ****
--- 271,278 ----
$tags["BLOCK_LABEL"] = $_SESSION['translate']->it("Show in Block");
$tags["BLOCK_HELP"] = $_SESSION["OBJ_help"]->show_link("rssfeeds", "showBlock");
+ $tags["ALLOW_VIEW_LABEL"] = $_SESSION['translate']->it("Allow Block View");
+ $tags["ALLOW_VIEW_HELP"] = $_SESSION["OBJ_help"]->show_link("rssfeeds", "allowView");
+ $tags["PM_ALLOW_LABEL"] = $_SESSION['translate']->it("View with Pagemaster pages");
+ $tags["PM_ALLOW_HELP"] = $_SESSION["OBJ_help"]->show_link("rssfeeds", "pmView");
$tags["TARGET_LABEL"] = $_SESSION['translate']->it("Target Window");
$tags["TARGET_HELP"] = $_SESSION["OBJ_help"]->show_link("rssfeeds", "rssTarget");
***************
*** 305,309 ****
} //END function delete
-
/**
* Displays current position listing
--- 340,343 ----
***************
*** 312,324 ****
*/
function view() {
! //debug info
! //print_r($this->_content);
! // Check to see if cache is expired...if so, update feed
! $dateDiff = date_time(date("Y-m-d G:i:s")) - date_time($this->_cached);
! if ($dateDiff/60 >= $this->_expire){
! $this->getContent();
! echo "Content Expired";
}
$form = new EZform("RSS_VIEW");
$form->add("CONTINUE_BUTTON", "submit", $_SESSION["translate"]->it("More Feeds"));
--- 346,376 ----
*/
function view() {
! //Check to see if feed exists and is active
! if(is_null($this->_content) || $this->_hidden && !$_SESSION["OBJ_user"]->isDeity()){
! $message = "<br /><b>" . $_SESSION['translate']->it("Sorry, that is not a working RSS feed.") . "</b><hr>";
! $message .= $this->_continueContent($_SESSION['translate']->it("Return to Feeds List"), "list");
! return $message;
! }
! /**
! *Check to see if cache is expired and update feed
! *If the feed is down, try again in specified interval
! *May add notification if feed is down over a period of x intervals
! */
! if ($this->expired()){
! $content = $this->getContent();
! $this->_cached = date("Y-m-d G:i:s");
! //if feed has been updated, update var
! if(!is_null($content))
! $this->_content = $content;
!
! // save the feed
! $this->commit();
}
+
+ //debug info
+ //print_r($this->_content);
+ //print_r($this->_content[0]);
+
$form = new EZform("RSS_VIEW");
$form->add("CONTINUE_BUTTON", "submit", $_SESSION["translate"]->it("More Feeds"));
***************
*** 328,337 ****
$tags = $form->getTemplate();
! $tags["TITLE_LABEL"] = $_SESSION['translate']->it("Channel Title");
! $tags["FOOTER_LABEL"] = $_SESSION['translate']->it("Footer");
- $tags["TITLE"] = $this->getLabel();
- //Get display content
- $tags["CHANNEL_IMAGE"] = "<a href=\"" . $this->_content[0]['link'] . "\" alt=\"" . $this->_content[0]['title'] . "\" target=\"_blank\"><img src=\"" . $this->_content[0]['url'] . "\" border=\"0\"></a><br />";
foreach ($this->_content as $item) {
if ($item['type'] == 'item'){
--- 380,400 ----
$tags = $form->getTemplate();
! if($this->_show_title)
! $tags["TITLE"] = $this->getLabel();
! if($this->_show_title && $this->_show_url)
! $tags["TITLE"] = "<a href=\"" . $this->_content[0]['link'] . "\" target=\"" . $this->_target . "\">" .
! $this->getLabel() . "</a>";
!
! if($this->_show_image && isset($this->_content[0]['url']))
! $tags["CHANNEL_IMAGE"] = "<a href=\"" . $this->_content[0]['link'] . "\" alt=\""
! . $this->_content[0]['title'] . "\" target=\"_blank\"><img src=\"" . $this->_content[0]['url']
! . "\" border=\"0\"></a><br />";
!
! if($this->_show_desc)
! $tags["CHANNEL_DESC"] = $this->_content[0]['description'];
!
! if($this->_footer)
! $tags["CHANNEL_FOOTER"] = $this->_footer;
foreach ($this->_content as $item) {
if ($item['type'] == 'item'){
***************
*** 339,347 ****
$elements['ITEM_TITLE'] = $item['title'];
$elements['ITEM_DESC'] = $item['description'];
$items .= $GLOBALS["core"]->processTemplate($elements, "rssfeeds", "item.tpl");
}
}
$tags["CONTENT"] = $items;
- $tags["FOOTER"] = $this->_footer;
// get a list of the categories for this feed from FatCat
$tags["CATEGORY"] = $_SESSION['OBJ_fatcat']->fatcatLinks($this->getId(), "rssfeeds");
--- 402,410 ----
$elements['ITEM_TITLE'] = $item['title'];
$elements['ITEM_DESC'] = $item['description'];
+ $elements["TARGET"] = $this->_target;
$items .= $GLOBALS["core"]->processTemplate($elements, "rssfeeds", "item.tpl");
}
}
$tags["CONTENT"] = $items;
// get a list of the categories for this feed from FatCat
$tags["CATEGORY"] = $_SESSION['OBJ_fatcat']->fatcatLinks($this->getId(), "rssfeeds");
***************
*** 382,391 ****
$this->_show_url = PHPWS_Text::parseInput($_REQUEST["SHOW_URL"]);
$this->_show_desc = PHPWS_Text::parseInput($_REQUEST["SHOW_DESC"]);
$this->_home = PHPWS_Text::parseInput($_REQUEST["HOME"]);
$this->_block = PHPWS_Text::parseInput($_REQUEST["BLOCK"]);
$this->_target = PHPWS_Text::parseInput($_REQUEST["TARGET"]);
$this->_expire = PHPWS_Text::parseInput($_REQUEST["EXPIRE"]);
$this->_cached = PHPWS_Text::parseInput($_REQUEST["CACHED"]);
!
if(is_null($this->_content)){
$message = "<br /><b>" . $_SESSION['translate']->it("Sorry, that is not a working RSS feed.") . "</b><hr>";
--- 445,459 ----
$this->_show_url = PHPWS_Text::parseInput($_REQUEST["SHOW_URL"]);
$this->_show_desc = PHPWS_Text::parseInput($_REQUEST["SHOW_DESC"]);
+ $current_home = $this->_home;
$this->_home = PHPWS_Text::parseInput($_REQUEST["HOME"]);
+ //saves current status of view block in $current_block
+ $current_block = $this->_block;
$this->_block = PHPWS_Text::parseInput($_REQUEST["BLOCK"]);
$this->_target = PHPWS_Text::parseInput($_REQUEST["TARGET"]);
$this->_expire = PHPWS_Text::parseInput($_REQUEST["EXPIRE"]);
$this->_cached = PHPWS_Text::parseInput($_REQUEST["CACHED"]);
! $this->allow_view = serialize($_REQUEST["ALLOW_VIEW"]);
! $this->pm_allow = serialize($_REQUEST["PM_ALLOW"]);
! $this->channel_desc = $this->_content[0]['description'];
if(is_null($this->_content)){
$message = "<br /><b>" . $_SESSION['translate']->it("Sorry, that is not a working RSS feed.") . "</b><hr>";
***************
*** 396,409 ****
$this->commit();
// save the category
! $element_link = "index.php?module=rssfeeds&RSS_MAN_op=sView&RSS_id=" . $this->getId();
! $_SESSION['OBJ_fatcat']->saveSelect($this->getLabel(), $element_link, $this->getId());
}
if ($error) {
! $GLOBALS["CNT_rssfeeds"]["title"] = "<span class=\"errortext\">" . $_SESSION['translate']->it("Error") . "</span>";
$content = $message . $this->edit();
} else {
/// tell user data is saved or updated
! if ($newjob) {
$content = $this->_continueContent($_SESSION['translate']->it("RSS Feed saved."), "list");
} else {
--- 464,495 ----
$this->commit();
// save the category
! $_id = $this->getId();
! $element_link = "index.php?module=rssfeeds&RSS_MAN_op=sView&RSS_id=" . $_id;
! $_SESSION['OBJ_fatcat']->saveSelect($this->getLabel(), $element_link, $_id);
!
! //set the side block in layout
! if($newrss && $this->_block == 1)
! $_SESSION['OBJ_layout']->create_temp("rssfeeds", "CNT_rssfeeds_".$_id, right_col_mid);
! if($current_block == 0 && $this->_block == 1)
! $_SESSION['OBJ_layout']->create_temp("rssfeeds", "CNT_rssfeeds_".$_id, right_col_mid);
! if($current_block == 1 && $this->_block == 0)
! PHPWS_Layout::dropBox("CNT_rssfeeds_".$_id);
!
! //set the main item in layout
! if($newrss && $this->_home == 1)
! $_SESSION['OBJ_layout']->create_temp("rssfeeds", "CNT_rssfeeds_home_".$_id, body);
! if($current_home == 0 && $this->_home == 1)
! $_SESSION['OBJ_layout']->create_temp("rssfeeds", "CNT_rssfeeds_home_".$_id, body);
! if($current_home == 1 && $this->_home == 0)
! PHPWS_Layout::dropBox("CNT_rssfeeds_home_".$_id);
}
if ($error) {
! $GLOBALS["CNT_rssfeeds"]["title"] = "<span class=\"errortext\">" . $_SESSION['translate']->it("Error")
! . "</span>";
$content = $message . $this->edit();
} else {
/// tell user data is saved or updated
! if ($newrss) {
$content = $this->_continueContent($_SESSION['translate']->it("RSS Feed saved."), "list");
} else {
***************
*** 475,546 ****
return;
}//end function_getContent
!
/**
! * Saves data for rss object to database when cache is expired.
*
* @author Wendall Cada <wen...@NO...>
*/
! function _update() {
!
! // save the edited data in the database in either case
! // note that parseInput called this way allows the global set of HTML tags to be included
! $this->setLabel(PHPWS_Text::parseInput($_REQUEST["TITLE"]));
! $this->_channel = PHPWS_Text::parseInput($_REQUEST["CHANNEL"]);
! $this->_content = $this->getContent();
! $this->_footer = PHPWS_Text::parseInput($_REQUEST["FOOTER"]);
! $this->_show_title = PHPWS_Text::parseInput($_REQUEST["_SHOW_TITLE"]);
! $this->_show_image = PHPWS_Text::parseInput($_REQUEST["_SHOW_IMAGE"]);
! $this->_show_url = PHPWS_Text::parseInput($_REQUEST["_SHOW_URL"]);
! $this->_show_desc = PHPWS_Text::parseInput($_REQUEST["_SHOW_DESC"]);
! $this->_home = PHPWS_Text::parseInput($_REQUEST["_HOME"]);
! $this->_block = PHPWS_Text::parseInput($_REQUEST["_BLOCK"]);
! $this->_block = PHPWS_Text::parseInput($_REQUEST["_TARGET"]);
! $this->_block = PHPWS_Text::parseInput($_REQUEST["_EXPIRE"]);
!
! if(is_null($this->_content)){
! $message = "<br /><b>" . $_SESSION['translate']->it("Sorry, that is not a working RSS feed.") . "</b><hr>";
! $_REQUEST["TITLE"] = $_SESSION['translate']->it("Error");
! $error = TRUE;
! }else{
// save the feed
$this->commit();
- // save the category
- $element_link = "index.php?module=rssfeeds&RSS_MAN_op=sView&RSS_id=" . $this->getId();
- $_SESSION['OBJ_fatcat']->saveSelect($this->getLabel(), $element_link, $this->getId());
}
!
! if ($error) {
! $GLOBALS["CNT_rssfeeds"]["title"] = "<span class=\"errortext\">" . $_SESSION['translate']->it("Error") . "</span>";
! $content = $message . $this->edit();
! } else {
! /// tell user data is saved or updated
! if ($newjob) {
! $content = $this->_continueContent($_SESSION['translate']->it("RSS Feed saved."), "list");
! } else {
! $content = $this->_continueContent($_SESSION['translate']->it("RSS Feed updated."), "list");
! }
! $GLOBALS["CNT_rssfeeds"]["title"] = $_SESSION['translate']->it("RSS Feeds");
! }
! // set content display
! $GLOBALS["CNT_rssfeeds"]["content"] = $content;
!
! } //END function _update
! }
/**
! * Returns mktime for date/time comparison.
*
* @author Wendall Cada <wen...@NO...>
*/
! function date_time($timestamp) {
! //parse time stamp from format date(Y-m-d G:i:s) 2003-08-26 11:41:33
! $month = substr($timestamp,5,2);
! $day = substr($timestamp,8,2);
! $year = substr($timestamp,0,4);
! $hour = substr($timestamp,11,2);
! $min = substr($timestamp,14,2);
! $sec = substr($timestamp,17,2);
! $date_time = mktime($hour,$min,$sec,$month,$day,$year);
! return $date_time;
! }
?>
--- 561,709 ----
return;
}//end function_getContent
!
/**
! * Sets up content for view in block
*
* @author Wendall Cada <wen...@NO...>
*/
! function showUserBox() {
! //Check to see if module allowed is current
! if(is_array($this->allow_view)){
! $modules_allowed = $this->get_modules_allowed();
! foreach($this->allow_view as $num){
! if(((isset($_REQUEST['module']) && ($_REQUEST['module'] == $modules_allowed[$num]))
! || (!isset($_REQUEST['module']) && ("home" == $modules_allowed[$num]))))
! $confirm = TRUE;
! }
! }
!
! //Check to see if pagemaster page allowed is current
! if(!$confirm){
! if(is_array($this->pm_allow)){
! if(!$_REQUEST['module'] == 'pagemaster')
! return;
! foreach($this->pm_allow as $num){
! if(isset($_REQUEST['PAGE_id']) && $_REQUEST['PAGE_id'] == $num)
! $confirm = TRUE;
! }
! if(!$confirm)
! return;
! }else{
! return;
! }
! }
! /**
! *Check to see if cache is expired and update feed
! *If the feed is down, try again in specified interval
! *May add notification if feed is down over a period of x intervals
! */
! if ($this->expired()){
! $content = $this->getContent();
! $this->_cached = date("Y-m-d G:i:s");
!
! //if feed has been updated, update var
! if(!is_null($content))
! $this->_content = $content;
!
// save the feed
$this->commit();
}
!
! $tags = array();
!
! $tags["TITLE"] = $this->getLabel();
! if($this->_show_title && $this->_show_url)
! $tags["TITLE"] = "<a href=\"" . $this->_content[0]['link'] . "\" target=\"" . $this->_target . "\">" .
! $this->getLabel() . "</a>";
!
! if($this->_show_image && isset($this->_content[0]['url']))
! $tags["CHANNEL_IMAGE"] = "<a href=\"" . $this->_content[0]['link'] . "\" alt=\""
! . $this->_content[0]['title'] . "\" target=\"_blank\"><img src=\"" . $this->_content[0]['url']
! . "\" border=\"0\"></a><br />";
!
! if($this->_show_desc)
! $tags["CHANNEL_DESC"] = $this->_content[0]['description'];
!
! if($this->_footer)
! $tags["CHANNEL_FOOTER"] = $this->_footer;
!
! foreach ($this->_content as $item) {
! if ($item['type'] == 'item'){
! $elements['ITEM_LINK'] = $item['link'];
! $elements['ITEM_TITLE'] = $item['title'];
! $elements["TARGET"] = $this->_target;
! $items .= $GLOBALS["core"]->processTemplate($elements, "rssfeeds", "block_item.tpl");
! }
! }
! $tags["CONTENT"] = $items;
! $content = $GLOBALS["core"]->processTemplate($tags, "rssfeeds", "rss_block.tpl");
! $content_var = "CNT_rssfeeds_" . $this->getId();
! $GLOBALS[$content_var]['title'] = $tags["TITLE"];
! $GLOBALS[$content_var]['content'] = $content;
!
! } //END function showUserBox
!
! function showHomeItems(){
! $content = $this->view();
! $content_var = "CNT_rssfeeds_home_" . $this->getId();
! $GLOBALS[$content_var]['title'] = "RSS News Feed";
! $GLOBALS[$content_var]['content'] = $content;
! }
!
/**
! * Returns return boolean TRUE if feed is expired.
*
* @author Wendall Cada <wen...@NO...>
*/
! function expired() {
! $date = $this->_cached;
! $month = substr($date,5,2);
! $day = substr($date,8,2);
! $year = substr($date,0,4);
! $hour = substr($date,11,2);
! $min = substr($date,14,2);
! $sec = substr($date,17,2);
! $epoch = mktime($hour,$min,$sec,$month,$day,$year);
! $exp = mktime() - $epoch;
! $exp = floor($exp / 60);
! if($exp >= $this->_expire)
! return TRUE;
! else
! return FALSE;
! }//END function expired
!
! /**
! * get_modules_allowed
! *
! * listing of allowed modules
! *
! * @return array listing
! */
! function get_modules_allowed() {
! $modulesAllowed = $GLOBALS['core']->listModules();
!
! $text = $_SESSION['translate']->it("Select Modules Allowed");
! $options = array($text,
! "----------------------------------------------");
! array_push($options, "home");
! $modulesAllowed = array_merge($options, $modulesAllowed);
!
! return $modulesAllowed;
! }//END function get_modules_allowed
!
! /**
! * Get a list of pagemaster pages
! *
! * refreshes the list of available pagemaster pages
! */
! function getPMOptions() {
! $sql = "SELECT id, title FROM " . $GLOBALS['core']->tbl_prefix . "mod_pagemaster_pages";
! $page_result = $GLOBALS['core']->query($sql);
! $pageOptions[0] = "";
! while($page = $page_result->fetchrow(DB_FETCHMODE_ASSOC)) $pageOptions[$page['id']] = $page['title'];
! return $pageOptions;
! }//END getPMOptions
!
! }
?>
Index: RSSManager.php
===================================================================
RCS file: /cvsroot/phpwebsite-comm/modules/rssfeeds/class/RSSManager.php,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** RSSManager.php 26 Sep 2003 21:07:47 -0000 1.2
--- RSSManager.php 17 Oct 2003 21:17:46 -0000 1.3
***************
*** 1,197 ****
! <?php
!
! /**
! * RSSManager.php
! * Defines the RSS_ListManager class, which manages the list of individual jobs
! *
! * This class is an extension of the PHPWS_Manager class defined in core/Manager.php.
! * Its function is to display a sortable list of items, and to provide an interface
! * to the editing, viewing and deleting of individual items as specified in an
! * extenison of the PHPWS_Item class defined in core/Item.php. It does so by
! * over-riding the standard functions _list(), _edit(), _view(), and _delete() defined in
! * Manager.php, and adding an action() function to handle additional procedures, in
! * this case the addition of a new RSS Feed to the list, and the creation of a menu
! * item to display the list.
! *
! * @version $Id$
! * @author Wendall Cada <wen...@us...>
! *
! */
!
! class RSS_ListManager extends PHPWS_Manager {
! /**
! * Current RSS listing
! *
! * @var rss object
! * @access private
! */
! var $rss;
!
! /**
! * Constructor for RSS list manager object
! *
! * @author Wendall Cada <wen...@us...>
! */
! function RSS_ListManager() {
! $this->setModule("rssfeeds"); /* tells PHPWS_Manager where the files are */
! $this->setRequest("RSS_MAN_op"); /* tells PHPWS_Manager the list manager opcode name */
! $this->setTable("mod_rssfeeds_feeds"); /* tells PHPWS_Manager the table containing items to list */
! $this->init(); /* initializes the list manager object */
! } // END function JOB_ListManager
!
!
! /**
! * Provides standard list function: list all items in form appropriate for user
! * If function is named _list(), is called directly by managerAction() via index.php
! *
! * @author Wendall Cada <wen...@us...>
! */
! function _list() {
!
! /* if user has admin privileges, display menu with "Add" button and admin format list */
! if ($_SESSION["OBJ_user"]->isDeity() || $_SESSION["OBJ_user"]->allow_access("rssfeeds")) {
!
! /* set tags for the template */
! $tags["ADD_RSS_LABEL"] = $_SESSION["translate"]->it("Add RSS Feed");
! /* add help for this button using mod/help -- see conf/help.php */
! $tags["ADD_RSS_HELP"] = $_SESSION["OBJ_help"]->show_link("rssfeeds", "rssAddFeed");
! $tags["CREATE_MENU_LINK_LABEL"] = $_SESSION["translate"]->it("Create Menu Link");
! $tags["CREATE_MENU_LINK_HELP"] = $_SESSION["OBJ_help"]->show_link("rssfeeds", "rssAddMenuLink");
! /* and process the template templates/menu.tpl to produce the menu */
! $content = $GLOBALS["core"]->processTemplate($tags, "rssfeeds", "menu.tpl");
! /* add admin form of list */
! $content .= $this->getList("admin", $_SESSION['translate']->it("RSS Feeds"));
!
! } else { /* otherwise, display user format list */
!
! $content = $this->getList("user", $_SESSION['translate']->it("RSS Feeds"));
! }
!
! /* set display variables */
! $GLOBALS["CNT_rssfeeds"]["title"] = $_SESSION['translate']->it("RSS Feeds");
! $GLOBALS["CNT_rssfeeds"]["content"] = $content;
!
! } //END function _list
!
! /**
! * Provides standard edit function: edits a list item
! * If called _edit, is called directly by managerAction() via index.php
! * Note that managerAction only calls this function if there is an item to edit
! *
! * @author Wendall Cada <wen...@us...>
! */
! function _edit() {
!
! $this->rss = new RSS($_REQUEST["PHPWS_MAN_ITEMS"][0]); /* PHPWS_MAN_ITEMS[0] contains the jobid */
! $content = $this->rss->edit();
!
! /* set display variables */
! $GLOBALS["CNT_rssfeeds"]["title"] = $_SESSION['translate']->it("RSS Feeds");
! $GLOBALS["CNT_rssfeeds"]["content"] = $content;
!
! } //END function edit
!
! /**
! * Provides standard delete function: deletes a list item
! * If called _delete, is called directly by managerAction() via index.php
! * Note that managerAction only calls this function if there is an item to delete
! *
! * @author Wendall Cada <wen...@us...>
! */
! function _delete() {
!
! $this->rss = new RSS($_REQUEST["PHPWS_MAN_ITEMS"][0]); /* PHPWS_MAN_ITEMS[0] contains the jobid */
! $content = $this->rss->delete();
!
! /* set display variables */
! $GLOBALS["CNT_rssfeeds"]["content"] = $this->rss->delete();
! $GLOBALS["CNT_rssfeeds"]["title"] = $_SESSION['translate']->it("RSS Feeds");
!
! } //END function _delete
!
! /**
! * Provides standard view function: displays a list item
! * If called _view, is called directly by managerAction() via index.php
! * Note that managerAction only calls this function if there is an item to view
! *
! * @author Wendall Cada <wen...@us...>
! */
! function _view() {
!
! $this->rss = new RSS($_REQUEST["PHPWS_MAN_ITEMS"][0]); /* PHPWS_MAN_ITEMS[0] contains the jobid */
! $content = $this->rss->view();
!
! /* set display variables */
! $GLOBALS["CNT_rssfeeds"]["content"] = $content;
! $GLOBALS["CNT_rssfeeds"]["title"] = $_SESSION['translate']->it("RSS Feeds");
!
! } //END function _view
!
!
! /**
! * Perform non-standard list manager actions
! *
! * @author Wendall Cada <wen...@us...>
! */
! function action() {
! switch($_REQUEST["RSS_MAN_op"]) {
! case "Add":
! $this->rss = new RSS(); /* create an 'empty' rss object (ref RSS.php) */
! $content = $this->rss->edit(); /* and edit it */
! $GLOBALS["CNT_rssfeeds"]["title"] = $_SESSION['translate']->it("RSS Feeds");
! $GLOBALS["CNT_rssfeeds"]["content"] = $content;
! break;
!
! case "sView": /* view an item chosen from search results */
! $this->rss = new RSS($_REQUEST["RSS_id"]);
! $content = $this->rss->view();
!
! /* set display variables */
! $GLOBALS["CNT_rssfeeds"]["content"] = $content;
! $GLOBALS["CNT_rssfeeds"]["title"] = $_SESSION['translate']->it("RSS Feeds");
! break;
!
! case "Menu":
! /* allow admin to add a menu item pointing to RSS Feeds list */
! if ($_SESSION["OBJ_user"]->isDeity() || $_SESSION["OBJ_user"]->allow_access("rssfeeds")) {
! if($GLOBALS['core']->moduleExists("menuman")) {
! $_SESSION['OBJ_menuman']->add_module_item("rssfeeds", "&RSS_MAN_op=list", "./index.php?module=rssfeeds&RSS_MAN_op=list", 1);
! }
! }
! break;
! }
!
! } //END function action
!
!
! /**
! * Searches the list of positions using the mod/search module
! * Configuration for the search appears in boost/install.php, where
! * this module is registered with the search module.
! * This function is called by the search module itself, from an accessory block.
! *
! * @param $where is a SELECT WHERE clause, passed from search module as
! * specified by user's search terms
! * @author Wendall Cada <wen...@us...>
! */
!
! function search($where) {
! /* set up database query using input from search module */
! $sql = "SELECT id, label FROM " . $GLOBALS['core']->tbl_prefix . "mod_rssfeeds_feeds " . $where . " AND hidden='0'";
! $linkResult = $GLOBALS['core']->query($sql); /* perform the selection from the database */
!
! /* if select returns any database rows */
! if($linkResult->numrows()) {
! /* create an array of the results */
! while($link = $linkResult->fetchrow(DB_FETCHMODE_ASSOC)) {
! $results[$link['id']] = $link['label'];
! }
! return $results; /* return results */
! } else {
! return FALSE; /* indicate no results */
! }
! } //END function search
!
!
! } //END class RSS_ListManager
! ?>
--- 1,255 ----
! <?php
!
! /**
! * RSSManager.php
! * Defines the RSS_ListManager class, which manages the list of individual jobs
! *
! * This class is an extension of the PHPWS_Manager class defined in core/Manager.php.
! * Its function is to display a sortable list of items, and to provide an interface
! * to the editing, viewing and deleting of individual items as specified in an
! * extenison of the PHPWS_Item class defined in core/Item.php. It does so by
! * over-riding the standard functions _list(), _edit(), _view(), and _delete() defined in
! * Manager.php, and adding an action() function to handle additional procedures, in
! * this case the addition of a new RSS Feed to the list, and the creation of a menu
! * item to display the list.
! *
! * @version $Id$
! * @author Wendall Cada <wen...@us...>
! *
! */
!
! class RSS_ListManager extends PHPWS_Manager {
! /**
! * Current RSS listing
! *
! * @var rss object
! * @access private
! */
! var $rss;
!
! /**
! * Block RSS listing
! *
! * @var rss object
! * @access private
! */
! var $rss_block;
!
! /**
! * Home page RSS listing
! *
! * @var rss object
! * @access private
! */
! var $rss_home;
!
! /**
! * Constructor for RSS list manager object
! *
! * @author Wendall Cada <wen...@us...>
! */
! function RSS_ListManager() {
! $this->setModule("rssfeeds"); /* tells PHPWS_Manager where the files are */
! $this->setRequest("RSS_MAN_op"); /* tells PHPWS_Manager the list manager opcode name */
! $this->setTable("mod_rssfeeds_feeds"); /* tells PHPWS_Manager the table containing items to list */
! $this->init(); /* initializes the list manager object */
! } // END function JOB_ListManager
!
!
! /**
! * Provides standard list function: list all items in form appropriate for user
! * If function is named _list(), is called directly by managerAction() via index.php
! *
! * @author Wendall Cada <wen...@us...>
! */
! function _list() {
! $tags["LIST_FEEDS"] = "<a href=\"index.php?module=rssfeeds&RSS_MAN_op=list\">"
! .$_SESSION["translate"]->it("List RSS Feeds")."</a>";
! /* if user has admin privileges, display menu with "Add" button and admin format list */
! if ($_SESSION["OBJ_user"]->isDeity() || $_SESSION["OBJ_user"]->allow_access("rssfeeds")) {
! // set tags for the template
! $tags["ADD_RSS_FEED"] = "<a href=\"index.php?module=rssfeeds&RSS_MAN_op=Add\">"
! .$_SESSION["translate"]->it("Add RSS Feed")."</a>";
! // add help for this button using mod/help -- see conf/help.php
! $tags["ADD_RSS_HELP"] = $_SESSION["OBJ_help"]->show_link("rssfeeds", "rssAddFeed");
! $tags["CREATE_MENU_LINK"] = "<a href=\"index.php?module=rssfeeds&RSS_MAN_op=Menu\">"
! .$_SESSION["translate"]->it("Add Menu Link")."</a>";
! $tags["CREATE_MENU_LINK_HELP"] = $_SESSION["OBJ_help"]->show_link("rssfeeds", "rssAddMenuLink");
! /* add admin form of list */
! /* process the template templates/menu.tpl to produce the menu */
! $content = $GLOBALS["core"]->processTemplate($tags, "rssfeeds", "menu.tpl");
! $content .= $this->getList("admin", $_SESSION['translate']->it("RSS Feeds"));
! } else { /* otherwise, display user format list */
! /* process the template templates/menu.tpl to produce the menu */
! $content = $GLOBALS["core"]->processTemplate($tags, "rssfeeds", "menu.tpl");
! $content .= $this->getList("user", $_SESSION['translate']->it("RSS Feeds"));
! }
! /* set display variables */
! $GLOBALS["CNT_rssfeeds"]["title"] = $_SESSION['translate']->it("RSS Feeds");
! $GLOBALS["CNT_rssfeeds"]["content"] = $content;
!
! } //END function _list
!
! /**
! * Provides standard edit function: edits a list item
! * If called _edit, is called directly by managerAction() via index.php
! * Note that managerAction only calls this function if there is an item to edit
! *
! * @author Wendall Cada <wen...@us...>
! */
! function _edit() {
!
! $this->rss = new RSS($_REQUEST["PHPWS_MAN_ITEMS"][0]); /* PHPWS_MAN_ITEMS[0] contains the rssid */
! $content = $this->rss->edit();
!
! /* set display variables */
! $GLOBALS["CNT_rssfeeds"]["title"] = $_SESSION['translate']->it("RSS Feeds");
! $GLOBALS["CNT_rssfeeds"]["content"] = $content;
!
! } //END function edit
!
! /**
! * Provides standard delete function: deletes a list item
! * If called _delete, is called directly by managerAction() via index.php
! * Note that managerAction only calls this function if there is an item to delete
! *
! * @author Wendall Cada <wen...@us...>
! */
! function _delete() {
!
! $this->rss = new RSS($_REQUEST["PHPWS_MAN_ITEMS"][0]); /* PHPWS_MAN_ITEMS[0] contains the rssid */
! $content = $this->rss->delete();
!
! /* set display variables */
! $GLOBALS["CNT_rssfeeds"]["content"] = $this->rss->delete();
! $GLOBALS["CNT_rssfeeds"]["title"] = $_SESSION['translate']->it("RSS Feeds");
!
! } //END function _delete
!
! /**
! * Provides standard view function: displays a list item
! * If called _view, is called directly by managerAction() via index.php
! * Note that managerAction only calls this function if there is an item to view
! *
! * @author Wendall Cada <wen...@us...>
! */
! function _view() {
!
! $this->rss = new RSS($_REQUEST["PHPWS_MAN_ITEMS"][0]); /* PHPWS_MAN_ITEMS[0] contains the rssid */
! $content = $this->rss->view();
!
! /* set display variables */
! $GLOBALS["CNT_rssfeeds"]["content"] = $content;
! $GLOBALS["CNT_rssfeeds"]["title"] = $_SESSION['translate']->it("RSS Feeds");
!
! } //END function _view
!
! /**
! * Perform non-standard list manager actions
! *
! * @author Wendall Cada <wen...@us...>
! */
! function action() {
! switch($_REQUEST["RSS_MAN_op"]) {
! case "Add":
! $this->rss = new RSS(); /* create an 'empty' rss object (ref RSS.php) */
! $content = $this->rss->edit(); /* and edit it */
! $GLOBALS["CNT_rssfeeds"]["title"] = $_SESSION['translate']->it("RSS Feeds");
! $GLOBALS["CNT_rssfeeds"]["content"] = $content;
! break;
!
! case "sView": /* view an item chosen from search results */
! $this->rss = new RSS($_REQUEST["RSS_id"]);
! $content = $this->rss->view();
!
! /* set display variables */
! $GLOBALS["CNT_rssfeeds"]["content"] = $content;
! $GLOBALS["CNT_rssfeeds"]["title"] = $_SESSION['translate']->it("RSS Feeds");
! break;
!
! case "Menu":
! /* allow admin to add a menu item pointing to RSS Feeds list */
! if ($_SESSION["OBJ_user"]->isDeity() || $_SESSION["OBJ_user"]->allow_access("rssfeeds")) {
! if($GLOBALS['core']->moduleExists("menuman")) {
! $_SESSION['OBJ_menuman']->add_module_item("rssfeeds", "&RSS_MAN_op=list", "./index.php?module=rssfeeds&RSS_MAN_op=list", 1);
! }
! }
! break;
!
! case "link":
! /* allow admin to add a menu item pointing to RSS Feeds list */
! if ($_SESSION["OBJ_user"]->isDeity() || $_SESSION["OBJ_user"]->allow_access("rssfeeds")) {
! if($GLOBALS['core']->moduleExists("menuman")) {
! $_SESSION['OBJ_menuman']->add_module_item("rssfeeds",
! "&RSS_MAN_op=view&PHPWS_MAN_ITEMS[]="
! . $_REQUEST["PHPWS_MAN_ITEMS"][0] ,
! "./index.php?module=rssfeeds&RSS_MAN_op=view&PHPWS_MAN_ITEMS[]="
! . $_REQUEST["PHPWS_MAN_ITEMS"][0] , 1);
! }
! }
! break;
! }
!
! } //END function action
!
! /**
! * Display Feeds in block on main page
! *
! * @author Wendall Cada <wen...@us...>
! */
! function showUserBox() {
! $result = $GLOBALS["core"]->sqlSelect("mod_rssfeeds_feeds", "block", 1);
! if($result){
! foreach($result as $block) {
! $this->rss_block = new RSS($block['id']);
! $this->rss_block->showUserBox();
! }
! }
! }//END showUserBox
!
! /**
! * Display Feeds on the home page
! *
! * @author Wendall Cada <wen...@us...>
! */
! function showHomeItems() {
! $result = $GLOBALS["core"]->sqlSelect("mod_rssfeeds_feeds", "home", 1);
! if($result){
! foreach($result as $home) {
! $this->rss_home = new RSS($home['id']);
! $this->rss_home->showHomeItems();
! }
! }
! }//END showHomeItems
!
! /**
! * Searches the list of positions using the mod/search module
! * Configuration for the search appears in boost/install.php, where
! * this module is registered with the search module.
! * This function is called by the search module itself, from an accessory block.
! *
! * @param $where is a SELECT WHERE clause, passed from search module as
! * specified by user's search terms
! * @author Wendall Cada <wen...@us...>
! */
!
! function search($where) {
! /* set up database query using input from search module */
! $sql = "SELECT id, label FROM " . $GLOBALS['core']->tbl_prefix . "mod_rssfeeds_feeds " . $where . " AND hidden='0'";
! $linkResult = $GLOBALS['core']->query($sql); /* perform the selection from the database */
!
! /* if select returns any database rows */
! if($linkResult->numrows()) {
! /* create an array of the results */
! while($link = $linkResult->fetchrow(DB_FETCHMODE_ASSOC)) {
! $results[$link['id']] = $link['label'];
! }
! return $results; /* return results */
! } else {
! return FALSE; /* indicate no results */
! }
! } //END function search
!
!
! } //END class RSS_ListManager
! ?>
|