Ejemplo n.º 1
0
/**
 * View items of the wurfl object
 *
 */
function wurfl_admin_view($args)
{
    if (!xarSecurityCheck('ManageWurfl')) {
        return;
    }
    $modulename = 'wurfl';
    // Define which object will be shown
    if (!xarVarFetch('objectname', 'str', $objectname, null, XARVAR_DONT_SET)) {
        return;
    }
    if (!empty($objectname)) {
        xarModUserVars::set($modulename, 'defaultmastertable', $objectname);
    }
    // Set a return url
    xarSession::setVar('ddcontext.' . $modulename, array('return_url' => xarServer::getCurrentURL()));
    // Get the available dropdown options
    $object = DataObjectMaster::getObjectList(array('objectid' => 1));
    $data['objectname'] = xarModUserVars::get($modulename, 'defaultmastertable');
    $items = $object->getItems();
    $options = array();
    foreach ($items as $item) {
        if (strpos($item['name'], $modulename) !== false) {
            $options[] = array('id' => $item['name'], 'name' => $item['name']);
        }
    }
    $data['options'] = $options;
    return $data;
}
Ejemplo n.º 2
0
function calendar_userapi_getUserDateTimeInfo()
{
    // dates come in as YYYYMMDD
    xarVarFetch('cal_date', 'str:4:8', $cal_date, xarLocaleFormatDate('%Y%m%d'));
    $data = array();
    $data['cal_date'] =& $cal_date;
    if (!preg_match('/([\\d]{4,4})([\\d]{2,2})?([\\d]{2,2})?/', $cal_date, $match)) {
        $year = xarLocaleFormateDate('Y');
        $month = xarLocaleFormateDate('m');
        $day = xarLocaleFormateDate('d');
    } else {
        $year = $match[1];
        if (isset($match[2])) {
            $month = $match[2];
        } else {
            $month = '01';
        }
        if (isset($match[3])) {
            $day = $match[3];
        } else {
            $day = '01';
        }
    }
    //$data['selected_date']   = (int) $year.$month.$day;
    $data['cal_day'] = (int) $day;
    $data['cal_month'] = (int) $month;
    $data['cal_year'] = (int) $year;
    //$data['selected_timestamp'] = gmmktime(0,0,0,$month,$day,$year);
    sys::import('xaraya.structures.datetime');
    $today = new XarDateTime();
    $usertz = xarModUserVars::get('roles', 'usertimezone', xarSession::getVar('role_id'));
    $useroffset = $today->getTZOffset($usertz);
    $data['now'] = getdate(time() + $useroffset);
    return $data;
}
Ejemplo n.º 3
0
/**
 *  Allows a user to modify their Calendar specific changes
 */
function calendar_user_updateconfig()
{
    xarVarFetch('cal_sdow', 'int:0:6', $cal_sdow, xarModUserVars::get('calendar', 'cal_sdow'));
    xarModUserVars::set('calendar', 'cal_sdow', $cal_sdow);
    xarVarFetch('default_view', 'str::', $default_view, xarModUserVars::get('calendar', 'default_view'));
    xarModUserVars::set('calendar', 'default_view', $default_view);
    xarController::redirect(xarModURL('calendar', 'user', 'modifyconfig'));
}
Ejemplo n.º 4
0
/**
 *  Allows a user to modify their Calendar specific changes
 */
function calendar_user_modifyconfig()
{
    xarVarFetch('cal_sdow', 'int:0:6', $cal_sdow, xarModUserVars::get('calendar', 'cal_sdow'));
    xarVarFetch('default_view', 'int:0:6', $default_view, xarModUserVars::get('calendar', 'default_view'));
    return array('cal_sdow' => $cal_sdow, 'default_view' => $default_view);
}
Ejemplo n.º 5
0
/**
 * get an array of root categories with links
 *
 * @param int $args['ptid'] publication type ID
 * @param $args['all'] boolean if we need to return all root categories when
 *                     ptid is empty (default false)
 * @return array
 * @TODO specify return format
 */
function publications_userapi_getrootcats($args)
{
    extract($args);
    if (empty($ptid) || !is_numeric($ptid)) {
        $ptid = null;
    }
    // see which root categories we need to handle
    $rootcats = array();
    if (!empty($ptid)) {
        $rootcats = unserialize(xarModUserVars::get('publications', 'basecids', $ptid));
    } elseif (empty($all)) {
        $rootcats = unserialize(xarModVars::get('publications', 'basecids'));
    } else {
        // Get publication types
        $pubtypes = xarModAPIFunc('publications', 'user', 'get_pubtypes');
        // get base categories for all publication types here
        $publist = array_keys($pubtypes);
        // add the defaults too, in case we have other base categories there
        $publist[] = '';
        // build the list of root categories for all required publication types
        $catlist = array();
        foreach ($publist as $pubid) {
            if (empty($pubid)) {
                $cidstring = xarModVars::get('publications', 'basecids');
            } else {
                $cidstring = xarModUserVars::get('publications', 'basecids', $pubid);
            }
            if (!empty($cidstring)) {
                $rootcats = unserialize($cidstring);
            } else {
                $rootcats = array();
            }
            foreach ($rootcats as $cid) {
                $catlist[$cid] = 1;
            }
        }
        if (count($catlist) > 0) {
            $rootcats = array_keys($catlist);
        }
    }
    if (empty($rootcats)) {
        $rootcats = array();
    }
    if (count($rootcats) < 1) {
        return array();
    }
    if (!xarModAPILoad('categories', 'user')) {
        return;
    }
    $isfirst = 1;
    $catlinks = array();
    $catlist = xarModAPIFunc('categories', 'user', 'getcatinfo', array('cids' => $rootcats));
    if (empty($catlist)) {
        return $catlinks;
    }
    // preserve order of root categories if possible
    foreach ($rootcats as $cid) {
        if (!isset($catlist[$cid])) {
            continue;
        }
        $info = $catlist[$cid];
        $item = array();
        $item['catid'] = $info['cid'];
        $item['cattitle'] = xarVarPrepForDisplay($info['name']);
        $item['catlink'] = xarModURL('publications', 'user', 'view', array('ptid' => $ptid, 'catid' => $info['cid']));
        if ($isfirst) {
            $item['catjoin'] = '';
            $isfirst = 0;
        } else {
            $item['catjoin'] = ' | ';
        }
        $item['catleft'] = $info['left'];
        $item['catright'] = $info['right'];
        $catlinks[] = $item;
    }
    return $catlinks;
}
Ejemplo n.º 6
0
/**
 * Calendar defaults
 *
 * @package unassigned
 * @copyright (C) 2003 by the Xaraya Development Team.
 * @license GPL {@link http://www.gnu.org/licenses/gpl.html}
 * @link http://www.xaraya.com
 *
 * @subpackage calendar
 * @link http://xaraya.simiansynapse.com
 * @author Roger Raymond <*****@*****.**>
 */
//======================================================================
//  Capture and set the calendar's First Day Of The Week
//======================================================================
$cal_sdow = (int) xarModUserVars::get('calendar', 'cal_sdow');
if (isset($cal_sdow)) {
    // Catch and set the first day of the week for the calendar views
    define('CALENDAR_FIRST_DAY_OF_WEEK', $cal_sdow);
} else {
    // set the first day of the week to the admin/user default
    define('CALENDAR_FIRST_DAY_OF_WEEK', 0);
}
//echo 'cal_sdow = '.CALENDAR_FIRST_DAY_OF_WEEK;
//======================================================================
// Define the location of the PEAR::Calendar files
//======================================================================
if (!defined('CALENDAR_ROOT')) {
    define('CALENDAR_ROOT', xarModVars::get('calendar', 'pearcalendar_root'));
}
//======================================================================