|
From: Verdon V. <ve...@us...> - 2008-06-12 21:19:17
|
Update of /cvsroot/phpwebsite-comm/modules/rolodex/class In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26163/class Modified Files: RDX_Forms.php RDX_Member.php Rolodex.php Added Files: RDX_Feature.php RDX_Location.php Log Message: add support for locations and features --- NEW FILE: RDX_Feature.php --- <?php /** * rolodex - phpwebsite module * * See docs/AUTHORS and docs/COPYRIGHT for relevant info. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * @version $Id: RDX_Feature.php,v 1.1 2008/06/12 21:18:52 verdonv Exp $ * @author Verdon Vaillancourt <verdonv at users dot sourceforge dot net> */ class Rolodex_Feature { var $id = 0; var $title = null; var $description = null; var $image_id = 0; var $_error = null; function Rolodex_Feature($id=0) { if (!$id) { return; } $this->id = (int)$id; $this->init(); } function init() { $db = new PHPWS_DB('rolodex_feature'); $result = $db->loadObject($this); if (PEAR::isError($result)) { $this->_error = & $result; $this->id = 0; } elseif (!$result) { $this->id = 0; } } function setTitle($title) { $this->title = strip_tags($title); } function setDescription($description) { $this->description = PHPWS_Text::parseInput($description); } function setImage_id($image_id) { $this->image_id = $image_id; } function getTitle($print=false) { if (empty($this->title)) { return null; } if ($print) { return PHPWS_Text::parseOutput($this->title); } else { return $this->title; } } function getDescription($print=false) { if (empty($this->description)) { return null; } if ($print) { return PHPWS_Text::parseOutput($this->description); } else { return $this->description; } } function getListDescription($length=60) { if (empty($this->description)) { return ''; } return substr(ltrim(strip_tags(str_replace('<br />', ' ', $this->getDescription(true)))), 0, $length) . ' ...'; } function getQtyMembers() { $db = new PHPWS_DB('rolodex_feature_items'); $db->addWhere('feature_id', $this->id); $num = $db->count(); return $num; } function getFile() { if (!$this->image_id) { return null; } return Cabinet::getTag($this->image_id); } function view() { if (!$this->id) { PHPWS_Core::errorPage(404); } Layout::addPageTitle($this->getTitle()); $template['TITLE'] = $this->getTitle(true); $template['DESCRIPTION'] = PHPWS_Text::parseTag($this->getDescription(true)); $template['IMAGE'] = $this->getFile(); if (Current_User::allow('rolodex', 'edit_feature')) { $vars['feature'] = $this->id; $vars['aop'] = 'edit_feature'; MiniAdmin::add('rolodex', array(PHPWS_Text::secureLink(dgettext('rolodex', 'Edit feature'), 'rolodex', $vars))); } if (Current_User::allow('rolodex', 'edit_feature')) { $vars2['aop'] = 'menu'; $vars2['tab'] = 'features'; MiniAdmin::add('rolodex', array(PHPWS_Text::secureLink(dgettext('rolodex', 'List all features'), 'rolodex', $vars2))); } $template['FEATURE_LINKS'] = $this->featureLinks(); $members = $this->getAllMembers(true); if (PHPWS_Error::logIfError($members)) { $this->rolodex->content = dgettext('rolodex', 'An error occurred when accessing this feature\'s members.'); return; } if ($members) { foreach ($members as $member) { $template['current-members'][] = $member->viewTpl(); } } return PHPWS_Template::process($template, 'rolodex', 'view_feature.tpl'); } function delete() { if (!$this->id) { return; } $db = new PHPWS_DB('rolodex_feature'); $db->addWhere('id', $this->id); PHPWS_Error::logIfError($db->delete()); $db = new PHPWS_DB('rolodex_feature_items'); $db->addWhere('feature_id', $this->id); PHPWS_Error::logIfError($db->delete()); } function getAllMembers($limit=false) { PHPWS_Core::initModClass('rolodex', 'RDX_Member.php'); $db = new PHPWS_DB('rolodex_member'); $db->addColumn('rolodex_feature_items.*'); $db->addColumn('rolodex_member.*'); $db->addColumn('demographics.*'); $db->addWhere('rolodex_member.user_id', 'rolodex_feature_items.member_id'); $db->addWhere('rolodex_feature_items.feature_id', $this->id); $db->addWhere('rolodex_member.user_id', 'demographics.user_id'); /* approved yes/no */ if (isset($approved)) { $addWhere('active', $approved); } /* expired yes/no */ if (PHPWS_Settings::get('rolodex', 'enable_expiry')) { if ($expired) { $addWhere('date_expires', mktime(), '<='); } else { $addWhere('date_expires', mktime(), '>='); } } /* make sure only unrestricted users see inactive members */ if (!Current_User::isUnrestricted('rolodex')) { $db->addWhere('active', 1); } /* set the default sort order and title column sort */ if (PHPWS_Settings::get('rolodex', 'sortby')) { $sortby = 'demographics.last_name'; // $db->joinResult('user_id', 'demographics', 'user_id', 'last_name', 'title'); } else { $sortby = 'demographics.business_name'; // $db->joinResult('user_id', 'demographics', 'user_id', 'business_name', 'title'); } /* deal with privacy levels */ if (!$_SESSION['User']->id) { $db->addWhere('rolodex_member.privacy', 0); } elseif (!Current_User::allow('rolodex', 'view_privates')) { $db->addWhere('rolodex_member.privacy', 1, '<='); } /* the default sort order */ $db->addOrder($sortby, 'asc', true); $result = $db->getObjects('Rolodex_Member'); return $result; } function rowTag() { $vars['feature'] = $this->id; if (Current_User::allow('rolodex', 'edit_feature')){ $vars['aop'] = 'edit_feature'; $links[] = PHPWS_Text::secureLink(dgettext('rolodex', 'Edit'), 'rolodex', $vars); } if (Current_User::allow('rolodex', 'delete_feature')){ $vars['aop'] = 'delete_feature'; $js['ADDRESS'] = PHPWS_Text::linkAddress('rolodex', $vars, true); $js['QUESTION'] = sprintf(dgettext('rolodex', 'Are you sure you want to delete the feature %s?'), $this->getTitle()); $js['LINK'] = dgettext('rolodex', 'Delete'); $links[] = javascript('confirm', $js); } $tpl['TITLE'] = $this->viewLink() . ' ('.$this->getQtyMembers().')'; $tpl['DESCRIPTION'] = $this->getListDescription(120); if($links) $tpl['ACTION'] = implode(' | ', $links); return $tpl; } function featureLinks() { if (Current_User::allow('rolodex', 'settings')) { $vars['feature'] = $this->id; $vars['aop'] = 'edit_feature'; $links[] = PHPWS_Text::secureLink(dgettext('rolodex', 'Edit feature'), 'rolodex', $vars); } $links[] = PHPWS_Text::moduleLink(dgettext('rolodex', 'Browse members'), 'rolodex', array('uop'=>'list')); $links[] = PHPWS_Text::moduleLink(dgettext('rolodex', 'Categories'), "rolodex", array('uop'=>'categories')); $links[] = PHPWS_Text::moduleLink(dgettext('rolodex', 'Locations'), "rolodex", array('uop'=>'locations')); $links[] = PHPWS_Text::moduleLink(dgettext('rolodex', 'Features'), "rolodex", array('uop'=>'features')); $links[] = PHPWS_Text::moduleLink(dgettext('rolodex', 'Advanced'), "rolodex", array('uop'=>'advanced')); if($links) return implode(' | ', $links); } function save() { $db = new PHPWS_DB('rolodex_feature'); $result = $db->saveObject($this); if (PEAR::isError($result)) { return $result; } } function viewLink() { // return PHPWS_Text::rewriteLink($this->title, 'rolodex', $this->id); $vars['uop'] = 'view_feature'; $vars['feature'] = $this->id; return PHPWS_Text::moduleLink(dgettext('rolodex', $this->title), 'rolodex', $vars); } } ?> Index: RDX_Forms.php =================================================================== RCS file: /cvsroot/phpwebsite-comm/modules/rolodex/class/RDX_Forms.php,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** RDX_Forms.php 11 Jun 2008 17:43:32 -0000 1.9 --- RDX_Forms.php 12 Jun 2008 21:18:52 -0000 1.10 *************** *** 131,134 **** --- 131,135 ---- function listMembers($approved=null, $expired=false) { + //print_r($_REQUEST); exit; /* init the classes */ PHPWS_Core::initModClass('rolodex', 'RDX_Member.php'); *************** *** 155,160 **** --- 156,163 ---- $pager->db->addColumn('demographics.*'); $pager->db->addColumn('rolodex_member.*'); + $pager->db->addWhere('rolodex_member.user_id', 'demographics.user_id'); + /* approved yes/no */ if (isset($approved)) { *************** *** 205,208 **** --- 208,227 ---- } } + + /* search by location */ + if (isset($_REQUEST['locations'])) { + $pager->db->addColumn('rolodex_location_items.*'); + $pager->db->addWhere('rolodex_member.user_id', 'rolodex_location_items.member_id'); + $pager->db->addWhere('rolodex_location_items.location_id', $_REQUEST['locations']); + $pager->db->addGroupBy('rolodex_location_items.member_id'); + } + + /* search by feature */ + if (isset($_REQUEST['features'])) { + $pager->db->addColumn('rolodex_feature_items.*'); + $pager->db->addWhere('rolodex_member.user_id', 'rolodex_feature_items.member_id'); + $pager->db->addWhere('rolodex_feature_items.feature_id', $_REQUEST['features']); + $pager->db->addGroupBy('rolodex_feature_items.member_id'); + } /* the default sort order */ *************** *** 256,259 **** --- 275,279 ---- $ptags['TITLE_HEADER'] = dgettext('rolodex', 'Title'); $ptags['DESCRIPTION_HEADER'] = dgettext('rolodex', 'Description'); + $ptags['ALPHA_CLICK'] = $this->rolodex->alpha_click(); PHPWS_Core::initModClass('rolodex', 'RDX_Location.php'); *************** *** 261,265 **** $pager = new DBPager('rolodex_location', 'Rolodex_Location'); $pager->setModule('rolodex'); ! $pager->setOrder('title', 'asc', true); $pager->setTemplate('list_location.tpl'); $pager->addRowTags('rowTag'); --- 281,286 ---- $pager = new DBPager('rolodex_location', 'Rolodex_Location'); $pager->setModule('rolodex'); ! // $pager->setOrder('title', 'asc', true); ! $pager->setDefaultOrder('title', 'asc', true); $pager->setTemplate('list_location.tpl'); $pager->addRowTags('rowTag'); *************** *** 282,285 **** --- 303,307 ---- $pager->addToggle('class="toggle1"'); $pager->setSearch('title', 'description'); + // $pager->addSortHeader('title', dgettext('rolodex', 'Title')); $this->rolodex->content = $pager->get(); *************** *** 292,295 **** --- 314,318 ---- $ptags['TITLE_HEADER'] = dgettext('rolodex', 'Title'); $ptags['DESCRIPTION_HEADER'] = dgettext('rolodex', 'Description'); + $ptags['ALPHA_CLICK'] = $this->rolodex->alpha_click(); PHPWS_Core::initModClass('rolodex', 'RDX_Feature.php'); *************** *** 324,327 **** --- 347,373 ---- + function advSearchForm() + { + $form = new PHPWS_Form('rolodex_adv_search'); + + $form->addHidden('module', 'rolodex'); + $form->addHidden('uop', 'adv_search'); + + $form->addSubmit(dgettext('rolodex', 'Go')); + $tpl = $form->getTemplate(); + + $tpl['ALPHA_CLICK'] = $this->rolodex->alpha_click(); + $tpl['LOCATION_SELECT'] = $this->rolodex->getItemSelect('location', null, 'locations'); + $tpl['FEATURE_SELECT'] = $this->rolodex->getItemSelect('feature', null, 'features'); + $tpl['LOCATION_LABEL'] = dgettext('rolodex', 'Location(s)'); + $tpl['FEATURE_LABEL'] = dgettext('rolodex', 'Feature(s)'); + $tpl['CRITERIA_LABEL'] = dgettext('rolodex', 'Criteria'); + + $this->rolodex->title = sprintf(dgettext('rolodex', '%s Advanced Search'), PHPWS_Settings::get('rolodex', 'module_title')); + $this->rolodex->content = PHPWS_Template::process($tpl, 'rolodex', 'adv_search_form.tpl'); + + } + + function editSettings() { *************** *** 780,785 **** $tpl['CATEGORIES'] = Categories::getForm($match=$member->get_categories(), $select_name='categories', $multiple=true); ! $tpl['LOCATIONS'] = $this->rolodex->getForm('location', $match=$member->get_locations(), $select_name='locations', $multiple=true); ! $tpl['FEATURES'] = $this->rolodex->getForm('feature', $match=$member->get_features(), $select_name='features', $multiple=true); $tpl['CATEGORIES_LABEL'] = dgettext('rolodex', 'Category(s)'); $tpl['LOCATIONS_LABEL'] = dgettext('rolodex', 'Location(s)'); --- 826,831 ---- $tpl['CATEGORIES'] = Categories::getForm($match=$member->get_categories(), $select_name='categories', $multiple=true); ! $tpl['LOCATIONS'] = $this->rolodex->getItemForm('location', $match=$member->get_locations(), $select_name='locations', $multiple=true); ! $tpl['FEATURES'] = $this->rolodex->getItemForm('feature', $match=$member->get_features(), $select_name='features', $multiple=true); $tpl['CATEGORIES_LABEL'] = dgettext('rolodex', 'Category(s)'); $tpl['LOCATIONS_LABEL'] = dgettext('rolodex', 'Location(s)'); --- NEW FILE: RDX_Location.php --- <?php /** * rolodex - phpwebsite module * * See docs/AUTHORS and docs/COPYRIGHT for relevant info. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * @version $Id: RDX_Location.php,v 1.1 2008/06/12 21:18:52 verdonv Exp $ * @author Verdon Vaillancourt <verdonv at users dot sourceforge dot net> */ class Rolodex_Location { var $id = 0; var $title = null; var $description = null; var $image_id = 0; var $_error = null; function Rolodex_Location($id=0) { if (!$id) { return; } $this->id = (int)$id; $this->init(); } function init() { $db = new PHPWS_DB('rolodex_location'); $result = $db->loadObject($this); if (PEAR::isError($result)) { $this->_error = & $result; $this->id = 0; } elseif (!$result) { $this->id = 0; } } function setTitle($title) { $this->title = strip_tags($title); } function setDescription($description) { $this->description = PHPWS_Text::parseInput($description); } function setImage_id($image_id) { $this->image_id = $image_id; } function getTitle($print=false) { if (empty($this->title)) { return null; } if ($print) { return PHPWS_Text::parseOutput($this->title); } else { return $this->title; } } function getDescription($print=false) { if (empty($this->description)) { return null; } if ($print) { return PHPWS_Text::parseOutput($this->description); } else { return $this->description; } } function getListDescription($length=60){ if (empty($this->description)) { return ''; } return substr(ltrim(strip_tags(str_replace('<br />', ' ', $this->getDescription(true)))), 0, $length) . ' ...'; } function getQtyMembers() { $db = new PHPWS_DB('rolodex_location_items'); $db->addWhere('location_id', $this->id); $num = $db->count(); return $num; } function getFile() { if (!$this->image_id) { return null; } return Cabinet::getTag($this->image_id); } function view() { if (!$this->id) { PHPWS_Core::errorPage(404); } Layout::addPageTitle($this->getTitle()); $template['TITLE'] = $this->getTitle(true); $template['DESCRIPTION'] = PHPWS_Text::parseTag($this->getDescription(true)); $template['IMAGE'] = $this->getFile(); if (Current_User::allow('rolodex', 'edit_location')) { $vars['location'] = $this->id; $vars['aop'] = 'edit_location'; MiniAdmin::add('rolodex', array(PHPWS_Text::secureLink(dgettext('rolodex', 'Edit location'), 'rolodex', $vars))); } if (Current_User::allow('rolodex', 'edit_location')) { $vars2['aop'] = 'menu'; $vars2['tab'] = 'locations'; MiniAdmin::add('rolodex', array(PHPWS_Text::secureLink(dgettext('rolodex', 'List all locations'), 'rolodex', $vars2))); } $template['LOCATION_LINKS'] = $this->locationLinks(); $members = $this->getAllMembers(true); if (PHPWS_Error::logIfError($members)) { $this->rolodex->content = dgettext('rolodex', 'An error occurred when accessing this location\'s members.'); return; } if ($members) { foreach ($members as $member) { $template['current-members'][] = $member->viewTpl(); } } return PHPWS_Template::process($template, 'rolodex', 'view_location.tpl'); } function delete() { if (!$this->id) { return; } $db = new PHPWS_DB('rolodex_location'); $db->addWhere('id', $this->id); PHPWS_Error::logIfError($db->delete()); $db = new PHPWS_DB('rolodex_location_items'); $db->addWhere('location_id', $this->id); PHPWS_Error::logIfError($db->delete()); } function getAllMembers($limit=false, $approved=null, $expired=false) { PHPWS_Core::initModClass('rolodex', 'RDX_Member.php'); $db = new PHPWS_DB('rolodex_member'); $db->addColumn('rolodex_location_items.*'); $db->addColumn('rolodex_member.*'); $db->addColumn('demographics.*'); $db->addWhere('rolodex_member.user_id', 'rolodex_location_items.member_id'); $db->addWhere('rolodex_location_items.location_id', $this->id); $db->addWhere('rolodex_member.user_id', 'demographics.user_id'); /* approved yes/no */ if (isset($approved)) { $addWhere('active', $approved); } /* expired yes/no */ if (PHPWS_Settings::get('rolodex', 'enable_expiry')) { if ($expired) { $addWhere('date_expires', mktime(), '<='); } else { $addWhere('date_expires', mktime(), '>='); } } /* make sure only unrestricted users see inactive members */ if (!Current_User::isUnrestricted('rolodex')) { $db->addWhere('active', 1); } /* set the default sort order and title column sort */ if (PHPWS_Settings::get('rolodex', 'sortby')) { $sortby = 'demographics.last_name'; // $db->joinResult('user_id', 'demographics', 'user_id', 'last_name', 'title'); } else { $sortby = 'demographics.business_name'; // $db->joinResult('user_id', 'demographics', 'user_id', 'business_name', 'title'); } /* deal with privacy levels */ if (!$_SESSION['User']->id) { $db->addWhere('rolodex_member.privacy', 0); } elseif (!Current_User::allow('rolodex', 'view_privates')) { $db->addWhere('rolodex_member.privacy', 1, '<='); } /* the default sort order */ $db->addOrder($sortby, 'asc', true); $result = $db->getObjects('Rolodex_Member'); return $result; } function rowTag() { $vars['location'] = $this->id; if (Current_User::allow('rolodex', 'edit_location')){ $vars['aop'] = 'edit_location'; $links[] = PHPWS_Text::secureLink(dgettext('rolodex', 'Edit'), 'rolodex', $vars); } if (Current_User::allow('rolodex', 'delete_location')){ $vars['aop'] = 'delete_location'; $js['ADDRESS'] = PHPWS_Text::linkAddress('rolodex', $vars, true); $js['QUESTION'] = sprintf(dgettext('rolodex', 'Are you sure you want to delete the location %s?'), $this->getTitle()); $js['LINK'] = dgettext('rolodex', 'Delete'); $links[] = javascript('confirm', $js); } $tpl['TITLE'] = $this->viewLink() . ' ('.$this->getQtyMembers().')'; $tpl['DESCRIPTION'] = $this->getListDescription(120); if($links) $tpl['ACTION'] = implode(' | ', $links); return $tpl; } function locationLinks() { if (Current_User::allow('rolodex', 'settings')) { $vars['location'] = $this->id; $vars['aop'] = 'edit_location'; $links[] = PHPWS_Text::secureLink(dgettext('rolodex', 'Edit location'), 'rolodex', $vars); } $links[] = PHPWS_Text::moduleLink(dgettext('rolodex', 'Browse members'), 'rolodex', array('uop'=>'list')); $links[] = PHPWS_Text::moduleLink(dgettext('rolodex', 'Categories'), "rolodex", array('uop'=>'categories')); $links[] = PHPWS_Text::moduleLink(dgettext('rolodex', 'Locations'), "rolodex", array('uop'=>'locations')); $links[] = PHPWS_Text::moduleLink(dgettext('rolodex', 'Features'), "rolodex", array('uop'=>'features')); $links[] = PHPWS_Text::moduleLink(dgettext('rolodex', 'Advanced'), "rolodex", array('uop'=>'advanced')); if($links) return implode(' | ', $links); } function save() { $db = new PHPWS_DB('rolodex_location'); $result = $db->saveObject($this); if (PEAR::isError($result)) { return $result; } } function viewLink() { // return PHPWS_Text::rewriteLink($this->title, 'rolodex', $this->id); $vars['uop'] = 'view_location'; $vars['location'] = $this->id; return PHPWS_Text::moduleLink(dgettext('rolodex', $this->title), 'rolodex', $vars); } } ?> Index: Rolodex.php =================================================================== RCS file: /cvsroot/phpwebsite-comm/modules/rolodex/class/Rolodex.php,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Rolodex.php 11 Jun 2008 17:43:32 -0000 1.7 --- Rolodex.php 12 Jun 2008 21:18:52 -0000 1.8 *************** *** 216,220 **** $this->location->delete(); $this->message = dgettext('rolodex', 'Location deleted.'); ! $this->loadForm('list'); break; --- 216,220 ---- $this->location->delete(); $this->message = dgettext('rolodex', 'Location deleted.'); ! $this->loadForm('locations'); break; *************** *** 242,246 **** $this->feature->delete(); $this->message = dgettext('rolodex', 'Feature deleted.'); ! $this->loadForm('list'); break; --- 242,246 ---- $this->feature->delete(); $this->message = dgettext('rolodex', 'Feature deleted.'); ! $this->loadForm('features'); break; *************** *** 334,337 **** --- 334,385 ---- break; + case 'locations': + if (!PHPWS_Settings::get('rolodex', 'allow_anon') && !Current_User::getId()) { + $this->title = PHPWS_Settings::get('rolodex', 'module_title'); + $this->content = dgettext('rolodex', 'Sorry, anonymous member viewing is not allowed. You will need to login to view this directory.'); + } else { + PHPWS_Core::initModClass('rolodex', 'RDX_Forms.php'); + $this->forms = new Rolodex_Forms; + $this->forms->rolodex = & $this; + $this->forms->listLocations(); + } + break; + + case 'features': + if (!PHPWS_Settings::get('rolodex', 'allow_anon') && !Current_User::getId()) { + $this->title = PHPWS_Settings::get('rolodex', 'module_title'); + $this->content = dgettext('rolodex', 'Sorry, anonymous member viewing is not allowed. You will need to login to view this directory.'); + } else { + PHPWS_Core::initModClass('rolodex', 'RDX_Forms.php'); + $this->forms = new Rolodex_Forms; + $this->forms->rolodex = & $this; + $this->forms->listFeatures(); + } + break; + + case 'advanced': + if (!PHPWS_Settings::get('rolodex', 'allow_anon') && !Current_User::getId()) { + $this->title = PHPWS_Settings::get('rolodex', 'module_title'); + $this->content = dgettext('rolodex', 'Sorry, anonymous member viewing is not allowed. You will need to login to view this directory.'); + } else { + PHPWS_Core::initModClass('rolodex', 'RDX_Forms.php'); + $this->forms = new Rolodex_Forms; + $this->forms->rolodex = & $this; + $this->forms->advSearchForm(); + } + break; + + case 'adv_search': + if (!PHPWS_Settings::get('rolodex', 'allow_anon') && !Current_User::getId()) { + $this->title = PHPWS_Settings::get('rolodex', 'module_title'); + $this->content = dgettext('rolodex', 'Sorry, anonymous member viewing is not allowed. You will need to login to view this directory.'); + } else { + PHPWS_Core::initModClass('rolodex', 'RDX_Forms.php'); + $this->forms = new Rolodex_Forms; + $this->forms->rolodex = & $this; + $this->forms->listMembers(1); + } + break; + case 'export': PHPWS_Core::initModClass('rolodex', 'RDX_Member.php'); *************** *** 469,472 **** --- 517,522 ---- } elseif (isset($_REQUEST['location'])) { $this->location = new Rolodex_Location($_REQUEST['location']); + } elseif (isset($_REQUEST['id'])) { + $this->location = new Rolodex_Location($_REQUEST['id']); } else { $this->location = new Rolodex_Location; *************** *** 485,488 **** --- 535,540 ---- } elseif (isset($_REQUEST['feature'])) { $this->feature = new Rolodex_Feature($_REQUEST['feature']); + } elseif (isset($_REQUEST['id'])) { + $this->feature = new Rolodex_Feature($_REQUEST['id']); } else { $this->feature = new Rolodex_Feature; *************** *** 994,1000 **** } ! if (empty($_POST['description'])) { ! $errors[] = dgettext('rolodex', 'You must give this location a description.'); ! } else { $this->location->setDescription($_POST['description']); } --- 1046,1050 ---- } ! if (isset($_POST['description'])) { $this->location->setDescription($_POST['description']); } *************** *** 1024,1030 **** } ! if (empty($_POST['description'])) { ! $errors[] = dgettext('rolodex', 'You must give this feature a description.'... [truncated message content] |