Example #1
0
/**
* Creates a new or edits and existing user record
* @param int The id of the record, 0 if a new entry
* @param string The current GET/POST option
*/
function editContact($edit)
{
    $db =& JFactory::getDBO();
    $user =& JFactory::getUser();
    $cid = JRequest::getVar('cid', array(0), '', 'array');
    $option = JRequest::getCmd('option');
    JArrayHelper::toInteger($cid, array(0));
    $row =& JTable::getInstance('contact', 'Table');
    // load the row from the db table
    if ($edit) {
        $row->load($cid[0]);
    }
    if ($edit) {
        // do stuff for existing records
        $row->checkout($user->get('id'));
    } else {
        // do stuff for new records
        $row->imagepos = 'top';
        $row->ordering = 0;
        $row->published = 1;
    }
    $lists = array();
    // build the html select list for ordering
    $query = 'SELECT ordering AS value, name AS text' . ' FROM #__contact_details' . ' WHERE published >= 0' . ' AND catid = ' . (int) $row->catid . ' ORDER BY ordering';
    if ($edit) {
        $lists['ordering'] = JHTML::_('list.specificordering', $row, $cid[0], $query);
    } else {
        $lists['ordering'] = JHTML::_('list.specificordering', $row, '', $query);
    }
    // build list of users
    $lists['user_id'] = JHTML::_('list.users', 'user_id', $row->user_id, 1, NULL, 'name', 0);
    // build list of categories
    $lists['catid'] = JHTML::_('list.category', 'catid', 'com_contact_details', intval($row->catid));
    // build the html select list for images
    $lists['image'] = JHTML::_('list.images', 'image', $row->image);
    // build the html select list for the group access
    $lists['access'] = JHTML::_('list.accesslevel', $row);
    // build the html radio buttons for published
    $lists['published'] = JHTML::_('select.booleanlist', 'published', '', $row->published);
    // build the html radio buttons for default
    $lists['default_con'] = JHTML::_('select.booleanlist', 'default_con', '', $row->default_con);
    // get params definitions
    $file = JPATH_ADMINISTRATOR . '/components/com_contact/contact_items.xml';
    $params = new JParameter($row->params, $file, 'component');
    HTML_contact::editcontact($row, $lists, $option, $params);
}
Example #2
0
 function view()
 {
     $database = mamboDatabase::getInstance();
     $query = "SELECT a.*, a.id AS value, CONCAT_WS( ' - ', a.name, a.con_position ) AS text" . "\n FROM #__contact_details AS a" . "\n LEFT JOIN #__categories AS cc ON cc.id = a.catid" . "\n WHERE a.published = '1'" . "\n AND cc.published = '1'" . "\n AND a.access <=" . $this->user->gid . "\n AND cc.access <=" . $this->user->gid . "\n ORDER BY a.default_con DESC, a.ordering ASC";
     $database->setQuery($query);
     $list = $database->loadObjectList();
     $count = count($list);
     if ($count == 0) {
         $params =& new mosParameters('');
         $params->def('back_button', mamboCore::get('mosConfig_back_button'));
         HTML_contact::nocontact($params);
         return;
     }
     if ($this->contact_id == 0) {
         $this->contact_id = $list[0]->id;
     }
     foreach ($list as $cont) {
         if ($cont->id == $this->contact_id) {
             $contact =& $cont;
             break;
         }
     }
     if (!isset($contact)) {
         echo T_('You are not authorized to view this resource.');
         return;
     }
     // creates dropdown select list
     $contact->select = mosHTML::selectList($list, 'contact_id', 'class="inputbox" onchange="ViewCrossReference(this);"', 'value', 'text', $this->contact_id);
     // Adds parameter handling
     $params =& $this->makeParams($contact->params);
     // load mambot params info
     $query = "SELECT id FROM #__mambots WHERE element = 'mosemailcloak' AND folder = 'content'";
     $database->setQuery($query);
     $id = $database->loadResult();
     $mambot = new mosMambot($database);
     $mambot->load($id);
     $params2 =& $this->makeParams($mambot->params);
     if ($contact->email_to and $params->get('email')) {
         // email cloacking
         $contact->email = mosHTML::emailCloaking($contact->email_to, $params2->get('mode'));
     }
     // loads current template for the pop-up window
     $pop = mosGetParam($_REQUEST, 'pop', 0);
     if ($pop) {
         $params->set('popup', 1);
         $params->set('back_button', 0);
     }
     if ($params->get('email_description')) {
         $params->set('email_description', $params->get('email_description_text'));
     } else {
         $params->set('email_description', '');
     }
     // needed to control the display of the Address marker
     $temp = $params->get('street_address') . $params->get('suburb') . $params->get('state') . $params->get('country') . $params->get('postcode');
     $params->set('address_check', $temp);
     // determines whether to use Text, Images or nothing to highlight the different info groups
     $this->groupMarking($params);
     // params from menu item
     $menuhandler = mosMenuHandler::getInstance();
     $menu =& $menuhandler->getMenuByID($this->Itemid);
     $menu_params =& new mosParameters($menu->params);
     $menu_params->def('page_title', 1);
     $menu_params->def('header', $menu->name);
     $menu_params->def('pageclass_sfx', '');
     HTML_contact::viewcontact($contact, $params, $count, $list, $menu_params);
 }
Example #3
0
function module_event()
{
    $option = JRequest::getVar('option');
    $mainframe = JFactory::getApplication();
    $db = JFactory::getDBO();
    $cal = JRequest::getVar('cal', 0);
    $cal = JRequest::getVar('cal', 0);
    if ($cal == '') {
        $cal = 0;
    }
    $filter_order = $mainframe->getUserStateFromRequest($option . 'filter_order_note', 'filter_order_note', 'id', 'cmd');
    $filter_order_Dir = $mainframe->getUserStateFromRequest($option . 'filter_order_Dir_note', 'filter_order_Dir_note', '', 'word');
    $filter_state = $mainframe->getUserStateFromRequest($option . 'filter_state_note', 'filter_state_note', '', 'word');
    $search_note = $mainframe->getUserStateFromRequest($option . 'search_note', 'search_note', '', 'string');
    $search_note = JString::strtolower($search_note);
    $limit = $mainframe->getUserStateFromRequest('global.list.limit', 'limit', $mainframe->getCfg('list_limit'), 'int');
    $limitstart = $mainframe->getUserStateFromRequest($option . '.limitstart', 'limitstart', 0, 'int');
    $lists = array();
    $where = array();
    $lists['search_note'] = $mainframe->getUserStateFromRequest($option . 'search_note', 'search_note', '', 'string');
    $lists['search_note'] = JString::strtolower($lists['search_note']);
    $lists['startdate'] = JRequest::getVar('startdate', "");
    $lists['enddate'] = JRequest::getVar('enddate', "");
    if ($lists['search_note']) {
        $where[] = ' se.title LIKE "%' . $db->escape($search_note) . '%" AND se.calendar="' . $cal . '" AND se.published="1"';
    }
    if ($lists['search_note']) {
        if ($lists['startdate'] != '') {
            $where[] = "  `date`>='" . $db->escape($lists['startdate']) . "' ";
        }
        if ($lists['enddate'] != '') {
            $where[] = "  `date`<='" . $db->escape($lists['enddate']) . "' ";
        }
    } else {
        if ($lists['startdate'] != '') {
            $where[] = "  `event_day`>='" . $db->escape($lists['startdate']) . "' AND calendar='" . $cal . "' ";
        }
        if ($lists['enddate'] != '') {
            $where[] = "  `event_day`<='" . $db->escape($lists['enddate']) . "' AND calendar='" . $cal . "'  ";
        }
    }
    $filter = '';
    $filter = count($where) ? ' WHERE ' . implode(' AND ', $where) : '';
    if (count($where) == 0) {
        $filter .= ' WHERE calendar=' . $cal . ' AND published="1"';
    }
    if ($filter_order == 'id') {
        $orderby = ' ORDER BY id ' . $filter_order_Dir;
    } else {
        $orderby = ' ORDER BY ' . $filter_order . ' ' . $filter_order_Dir . ', id';
    }
    // get the total number of records
    $query = 'SELECT COUNT(*)' . ' FROM #__spidercalendar_event ' . $filter;
    $db->setQuery($query);
    $total = $db->loadResult();
    jimport('joomla.html.pagination');
    $pageNav = new JPagination($total, $limitstart, $limit);
    $query = "SELECT * FROM #__spidercalendar_event  " . $filter . $orderby;
    $db->setQuery($query, $pageNav->limitstart, $pageNav->limit);
    $rows = $db->loadObjectList();
    if ($db->getErrorNum()) {
        echo $db->stderr();
        return false;
    }
    // table ordering
    $lists['order_Dir'] = $filter_order_Dir;
    $lists['order'] = $filter_order;
    // search filter
    $lists['search_note'] = $search_note;
    // display function
    if ($cal != 0) {
        HTML_contact::module_event($rows, $pageNav, $lists);
    } else {
        echo '<div style="text-align:center;"><p style="font-size:25px">Please select calendar</p><div>';
    }
}
/**
* Creates a new or edits and existing user record
* @param int The id of the record, 0 if a new entry
* @param string The current GET/POST option
*/
function editStudent($edit)
{
    $db =& JFactory::getDBO();
    $user =& JFactory::getUser();
    $cid = JRequest::getVar('cid', array(0), '', 'array');
    $option = JRequest::getCmd('option');
    JArrayHelper::toInteger($cid, array(0));
    $row =& JTable::getInstance('student', 'Table');
    // load the row from the db table
    if ($edit) {
        $row->load($cid[0]);
    }
    // get params definitions
    HTML_contact::editstudent($row);
}
Example #5
0
/**
* Creates a new or edits and existing user record
* @param int The id of the record, 0 if a new entry
* @param string The current GET/POST option
*/
function editContact($id, $option)
{
    global $database, $my;
    global $mosConfig_absolute_path;
    $row = new mosContact($database);
    // load the row from the db table
    $row->load($id);
    if ($id) {
        // do stuff for existing records
        $row->checkout($my->id);
    } else {
        // do stuff for new records
        $row->imagepos = 'top';
        $row->ordering = 0;
        $row->published = 1;
    }
    $lists = array();
    // build the html select list for ordering
    $query = "SELECT ordering AS value, name AS text" . "\n FROM #__contact_details" . "\n WHERE published >= 0" . "\n AND catid = '{$row->catid}'" . "\n ORDER BY ordering";
    $lists['ordering'] = mosAdminMenus::SpecificOrdering($row, $id, $query, 1);
    // build list of users
    $lists['user_id'] = mosAdminMenus::UserSelect('user_id', $row->user_id, 1);
    // build list of categories
    $lists['catid'] = mosAdminMenus::ComponentCategory('catid', 'com_contact_details', intval($row->catid));
    // build the html select list for images
    $lists['image'] = mosAdminMenus::Images('image', $row->image);
    // build the html select list for the group access
    $lists['access'] = mosAdminMenus::Access($row);
    // build the html radio buttons for published
    $lists['published'] = mosHTML::yesnoradioList('published', '', $row->published);
    // build the html radio buttons for default
    $lists['default_con'] = mosHTML::yesnoradioList('default_con', '', $row->default_con);
    // get params definitions
    $file = $mosConfig_absolute_path . '/administrator/components/com_contact/contact_items.xml';
    $params =& new mosAdminParameters($row->params, $file, 'component');
    HTML_contact::editcontact($row, $lists, $option, $params);
}
Example #6
0
    function viewcontact(&$contact, &$params, $count, &$list, &$menu_params)
    {
        global $mosConfig_live_site;
        global $mainframe, $Itemid;
        $template = $mainframe->getTemplate();
        $sitename = $mainframe->getCfg('sitename');
        $hide_js = mosGetParam($_REQUEST, 'hide_js', 0);
        ?>
		<script language="JavaScript" type="text/javascript">
		<!--
		function validate(){
			if ( ( document.emailForm.text.value == "" ) || ( document.emailForm.email.value.search("@") == -1 ) || ( document.emailForm.email.value.search("[.*]" ) == -1 ) ) {
				alert( "<?php 
        echo T_('Please make sure the form is complete and valid.');
        ?>
" );
			} else {
			document.emailForm.action = "<?php 
        echo sefRelToAbs("index.php?option=com_contact&Itemid={$Itemid}");
        ?>
"
			document.emailForm.submit();
			}
		}
		//-->
		</script>
		<script type="text/javascript">
		<!--
		function ViewCrossReference( selSelectObject ){
			var links = new Array();
			<?php 
        $n = count($list);
        for ($i = 0; $i < $n; $i++) {
            echo "\nlinks[" . $list[$i]->value . "]='" . str_replace('&amp;', '&', sefRelToAbs('index.php?option=com_contact&task=view&contact_id=' . $list[$i]->value . '&Itemid=' . $Itemid)) . "';";
        }
        ?>

			var sel = selSelectObject.options[selSelectObject.selectedIndex].value
			if (sel != "") {
				location.href = links[sel];
			}
		}
		//-->
		</script>
		<?php 
        // For the pop window opened for print preview
        if ($params->get('popup')) {
            ?>
			<title><?php 
            echo $sitename . " :: " . $contact->name;
            ?>
</title>
			<link rel="stylesheet" href="<?php 
            echo $mosConfig_live_site . "/templates/" . $template . "/css/template_css.css";
            ?>
" type="text/css" />
			<?php 
        }
        if ($menu_params->get('page_title')) {
            ?>
			<div class="componentheading<?php 
            echo $menu_params->get('pageclass_sfx');
            ?>
">
			<?php 
            echo $menu_params->get('header');
            ?>
			</div>
			<?php 
        }
        ?>

		<table width="100%" cellpadding="0" cellspacing="0" border="0" class="contentpane<?php 
        echo $params->get('pageclass_sfx');
        ?>
">
		<?php 
        // displays Page Title
        HTML_contact::_writePageTitle($params);
        // displays Contact Select box
        HTML_contact::_writeSelectContact($contact, $params, $count);
        // displays Name & Positione
        HTML_contact::_writeContactName($contact, $params, $hide_js);
        ?>
		<tr>
			<td>
				<table border="0" width="100%">
				<tr>
					<td></td>
					<td rowspan="2" align="right" valign="top">
					<?php 
        // displays Image
        HTML_contact::_writeImage($contact, $params);
        ?>
					</td>
				</tr>
				<tr>
					<td>
					<?php 
        // displays Address
        HTML_contact::_writeContactAddress($contact, $params);
        // displays Email & Telephone
        HTML_contact::_writeContactContact($contact, $params);
        // displays Misc Info
        HTML_contact::_writeContactMisc($contact, $params);
        ?>
					</td>
				</tr>
				</table>
			</td>
		</tr>
		<?php 
        // displays Email Form
        HTML_contact::_writeVcard($contact, $params);
        // displays Email Form
        HTML_contact::_writeEmailForm($contact, $params, $sitename);
        ?>
		</table>
		<?php 
        // display Close button in pop-up window
        mosHTML::CloseButton($params, $hide_js);
        // displays back button
        mosHTML::BackButton($params, $hide_js);
    }
Example #7
0
function contactpage($contact_id)
{
    global $mainframe, $database, $my, $Itemid;
    $query = "SELECT a.id AS value, CONCAT_WS( ' - ', a.name, a.con_position ) AS text, a.catid, cc.access AS cat_access" . "\n FROM #__contact_details AS a" . "\n LEFT JOIN #__categories AS cc ON cc.id = a.catid" . "\n WHERE a.published = 1" . "\n AND cc.published = 1" . "\n AND a.access <= " . (int) $my->gid . "\n ORDER BY a.default_con DESC, a.ordering ASC";
    $database->setQuery($query);
    $checks = $database->loadObjectList();
    $count = count($checks);
    if ($count) {
        if ($contact_id < 1) {
            $contact_id = $checks[0]->value;
        }
        $query = "SELECT a.*, cc.access AS cat_access" . "\n FROM #__contact_details AS a" . "\n LEFT JOIN #__categories AS cc ON cc.id = a.catid" . "\n WHERE a.published = 1" . "\n AND a.id = " . (int) $contact_id . "\n AND a.access <= " . (int) $my->gid;
        $database->SetQuery($query);
        $contacts = $database->LoadObjectList();
        if (!$contacts) {
            echo _NOT_AUTH;
            return;
        }
        $contact = $contacts[0];
        /*
         * check whether category access level allows access
         */
        if ($contact->cat_access > $my->gid) {
            mosNotAuth();
            return;
        }
        $list = array();
        foreach ($checks as $check) {
            if ($check->catid == $contact->catid) {
                $list[] = $check;
            }
        }
        // creates dropdown select list
        $contact->select = mosHTML::selectList($list, 'contact_id', 'class="inputbox" onchange="ViewCrossReference(this);"', 'value', 'text', $contact_id);
        // Adds parameter handling
        $params = new mosParameters($contact->params);
        $params->set('page_title', 0);
        $params->def('pageclass_sfx', '');
        $params->def('back_button', $mainframe->getCfg('back_button'));
        $params->def('print', !$mainframe->getCfg('hidePrint'));
        $params->def('name', 1);
        $params->def('email', 0);
        $params->def('street_address', 1);
        $params->def('suburb', 1);
        $params->def('state', 1);
        $params->def('country', 1);
        $params->def('postcode', 1);
        $params->def('telephone', 1);
        $params->def('fax', 1);
        $params->def('misc', 1);
        $params->def('image', 1);
        $params->def('email_description', 1);
        $params->def('email_description_text', _EMAIL_DESCRIPTION);
        $params->def('email_form', 1);
        $params->def('email_copy', 0);
        // global pront|pdf|email
        $params->def('icons', $mainframe->getCfg('icons'));
        // contact only icons
        $params->def('contact_icons', 0);
        $params->def('icon_address', '');
        $params->def('icon_email', '');
        $params->def('icon_telephone', '');
        $params->def('icon_fax', '');
        $params->def('icon_misc', '');
        $params->def('drop_down', 0);
        $params->def('vcard', 0);
        if ($contact->email_to && $params->get('email')) {
            // email cloacking
            $contact->email = mosHTML::emailCloaking($contact->email_to);
        }
        // loads current template for the pop-up window
        $pop = intval(mosGetParam($_REQUEST, 'pop', 0));
        if ($pop) {
            $params->set('popup', 1);
            $params->set('back_button', 0);
        }
        if ($params->get('email_description')) {
            $params->set('email_description', $params->get('email_description_text'));
        } else {
            $params->set('email_description', '');
        }
        // needed to control the display of the Address marker
        $temp = $params->get('street_address') . $params->get('suburb') . $params->get('state') . $params->get('country') . $params->get('postcode');
        $params->set('address_check', $temp);
        // determines whether to use Text, Images or nothing to highlight the different info groups
        switch ($params->get('contact_icons')) {
            case 1:
                // text
                $params->set('marker_address', _CONTACT_ADDRESS);
                $params->set('marker_email', _CONTACT_EMAIL);
                $params->set('marker_telephone', _CONTACT_TELEPHONE);
                $params->set('marker_fax', _CONTACT_FAX);
                $params->set('marker_misc', _CONTACT_MISC);
                $params->set('column_width', '100');
                break;
            case 2:
                // none
                $params->set('marker_address', '');
                $params->set('marker_email', '');
                $params->set('marker_telephone', '');
                $params->set('marker_fax', '');
                $params->set('marker_misc', '');
                $params->set('column_width', '0');
                break;
            default:
                // icons
                $image1 = mosAdminMenus::ImageCheck('con_address.png', '/images/M_images/', $params->get('icon_address'), '/images/M_images/', _CONTACT_ADDRESS, _CONTACT_ADDRESS);
                $image2 = mosAdminMenus::ImageCheck('emailButton.png', '/images/M_images/', $params->get('icon_email'), '/images/M_images/', _CONTACT_EMAIL, _CONTACT_EMAIL);
                $image3 = mosAdminMenus::ImageCheck('con_tel.png', '/images/M_images/', $params->get('icon_telephone'), '/images/M_images/', _CONTACT_TELEPHONE, _CONTACT_TELEPHONE);
                $image4 = mosAdminMenus::ImageCheck('con_fax.png', '/images/M_images/', $params->get('icon_fax'), '/images/M_images/', _CONTACT_FAX, _CONTACT_FAX);
                $image5 = mosAdminMenus::ImageCheck('con_info.png', '/images/M_images/', $params->get('icon_misc'), '/images/M_images/', _CONTACT_MISC, _CONTACT_MISC);
                $params->set('marker_address', $image1);
                $params->set('marker_email', $image2);
                $params->set('marker_telephone', $image3);
                $params->set('marker_fax', $image4);
                $params->set('marker_misc', $image5);
                $params->set('column_width', '40');
                break;
        }
        // params from menu item
        $menu = $mainframe->get('menu');
        $menu_params = new mosParameters($menu->params);
        $menu_params->def('page_title', 1);
        $menu_params->def('header', $menu->name);
        $menu_params->def('pageclass_sfx', '');
        HTML_contact::viewcontact($contact, $params, $count, $list, $menu_params);
    } else {
        $params = new mosParameters('');
        $params->def('back_button', $mainframe->getCfg('back_button'));
        HTML_contact::nocontact($params);
    }
}
Example #8
0
function select_article()
{
    $mainframe = JFactory::getApplication();
    $db = JFactory::getDBO();
    $option = 'com_formmaker';
    $filter_order = $mainframe->getUserStateFromRequest($option . 'filter_order', 'filter_order', 'id', 'cmd');
    $filter_order_Dir = $mainframe->getUserStateFromRequest($option . 'filter_order_Dir', 'filter_order_Dir', '', 'word');
    $filter_state = $mainframe->getUserStateFromRequest($option . 'filter_state', 'filter_state', '', 'word');
    $search = $mainframe->getUserStateFromRequest($option . 'search', 'search', '', 'string');
    $search = JString::strtolower($search);
    $limit = $mainframe->getUserStateFromRequest('global.list.limit', 'limit', $mainframe->getCfg('list_limit'), 'int');
    $limitstart = $mainframe->getUserStateFromRequest($option . '.limitstart', 'limitstart', 0, 'int');
    $where = array();
    if ($search) {
        $where[] = 'title LIKE "%' . $db->escape($search) . '%"';
    }
    $where = count($where) ? ' WHERE ' . implode(' AND ', $where) : '';
    if ($filter_order == 'id' or $filter_order == 'group_id' or $filter_order == 'group_id' or $filter_order == 'date' or $filter_order == 'ip') {
        $orderby = ' ORDER BY id';
    } else {
        $orderby = ' ORDER BY ' . $filter_order . ' ' . $filter_order_Dir . ', id';
    }
    // get the total number of records
    $query = 'SELECT COUNT(*)' . ' FROM #__content' . $where;
    $db->setQuery($query);
    $total = $db->loadResult();
    jimport('joomla.html.pagination');
    $pageNav = new JPagination($total, $limitstart, $limit);
    $query = "SELECT * FROM #__content" . $where . $orderby;
    $db->setQuery($query, $pageNav->limitstart, $pageNav->limit);
    $rows = $db->loadObjectList();
    if ($db->getErrorNum()) {
        echo $db->stderr();
        return false;
    }
    // table ordering
    $lists['order_Dir'] = $filter_order_Dir;
    $lists['order'] = $filter_order;
    // search filter
    $lists['search'] = $search;
    // display function
    HTML_contact::select_article($rows, $pageNav, $lists);
}