• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP xarML函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中xarML函数的典型用法代码示例。如果您正苦于以下问题:PHP xarML函数的具体用法?PHP xarML怎么用?PHP xarML使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了xarML函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: calendar_admin_add_event

function calendar_admin_add_event()
{
    // Security check
    if (!xarSecurityCheck('Admincalendar')) {
        return;
    }
    // Generate a one-time authorisation code for this operation
    $data = xarMod::apiFunc('calendar', 'admin', 'get_calendars');
    $data['authid'] = xarSecGenAuthKey();
    $data['default_cal'] = unserialize(xarModVars::get('calendar', 'default_cal'));
    // Variables from phpIcalendar config.inc.php
    $data['updatebutton'] = xarVarPrepForDisplay(xarML('Create event'));
    //TODO: should I include this stuff? --amoro
    /*    $hooks = xarModCallHooks('module', 'modifyconfig', 'calendar',
            array('module' => 'calendar'));
        if (empty($hooks)) {
            $data['hooks'] = '';
        } elseif (is_array($hooks)) {
            $data['hooks'] = join('', $hooks);
        } else {
            $data['hooks'] = $hooks;
        }
    */
    // Return the template variables defined in this function
    return $data;
}
开发者ID:godboko,项目名称:modules,代码行数:26,代码来源:add_event.php


示例2: publications_adminapi_delete

/**
 * Publications Module
 *
 * @package modules
 * @subpackage publications module
 * @category Third Party Xaraya Module
 * @version 2.0.0
 * @copyright (C) 2011 Netspan AG
 * @license GPL {@link http://www.gnu.org/licenses/gpl.html}
 * @author Marc Lutolf <[email protected]>
 */
function publications_adminapi_delete($args)
{
    // Get arguments from argument array
    extract($args);
    // Argument check
    if (!isset($itemid)) {
        $msg = xarML('Invalid #(1) for #(2) function #(3)() in module #(4)', 'publication ID', 'admin', 'delete', 'Publications');
        throw new BadParameterException(null, $msg);
    }
    $ids = !is_array($itemid) ? explode(',', $itemid) : $itemid;
    if (!isset($deletetype)) {
        $deletetype = 0;
    }
    sys::import('xaraya.structures.query');
    $table = xarDB::getTables();
    switch ($deletetype) {
        case 0:
        default:
            $q = new Query('UPDATE', $table['publications']);
            $q->addfield('state', 0);
            break;
        case 10:
            $q = new Query('DELETE', $table['publications']);
            break;
    }
    $q->in('id', $ids);
    if (!$q->run()) {
        return false;
    }
    return true;
}
开发者ID:godboko,项目名称:modules,代码行数:42,代码来源:delete.php


示例3: modify

 /**
  * Modify Function to the Blocks Admin
  * @author Jason Judge
  * @param $blockinfo array containing title,content
  */
 public function modify(array $data = array())
 {
     $data = $this->getContent();
     // Get a list of all pages for the drop-downs.
     // Get the tree of all pages, without the DD for speed.
     $data['all_pages'] = xarMod::apiFunc('publications', 'user', 'getpagestree', array('dd_flag' => false, 'key' => 'pid'));
     // Implode the names for each page into a path for display.
     // TODO: move this into getpagestree
     foreach ($data['all_pages']['pages'] as $key => $page) {
         $data['all_pages']['pages'][$key]['slash_separated'] = '/' . implode('/', $page['namepath']);
     }
     // Get the descriptions together for the current root ids.
     // TODO: we could prune the 'add root page' list so it only includes
     // the pages which are not yet under one of the selected root pages.
     // That would just be an extra little usability touch.
     $data['root_ids'] = array_flip($data['root_ids']);
     foreach ($data['root_ids'] as $key => $value) {
         if (isset($data['all_pages']['pages'][$key])) {
             $data['root_ids'][$key] = $data['all_pages']['pages'][$key]['slash_separated'];
         } else {
             $data['root_ids'][$key] = xarML('Unknown');
         }
     }
     $data['prune_ids'] = array_flip($data['prune_ids']);
     foreach ($data['prune_ids'] as $key => $value) {
         if (isset($data['all_pages']['pages'][$key])) {
             $data['prune_ids'][$key] = $data['all_pages']['pages'][$key]['slash_separated'];
         } else {
             $data['prune_ids'][$key] = xarML('Unknown');
         }
     }
     //            $vars['bid'] = $blockinfo['bid'];
     return $data;
 }
开发者ID:godboko,项目名称:modules,代码行数:39,代码来源:menu_admin.php


示例4: publications_admin_stats

/**
 * view statistics
 */
function publications_admin_stats($args = array())
{
    if (!xarSecurityCheck('AdminPublications')) {
        return;
    }
    if (!xarVarFetch('group', 'isset', $group, array(), XARVAR_NOT_REQUIRED)) {
        return;
    }
    extract($args);
    if (!empty($group)) {
        $newgroup = array();
        foreach ($group as $field) {
            if (empty($field)) {
                continue;
            }
            $newgroup[] = $field;
        }
        $group = $newgroup;
    }
    if (empty($group)) {
        $group = array('pubtype_id', 'state', 'owner');
    }
    $data = array();
    $data['group'] = $group;
    $data['stats'] = xarModAPIFunc('publications', 'admin', 'getstats', array('group' => $group));
    $data['pubtypes'] = xarModAPIFunc('publications', 'user', 'get_pubtypes');
    $data['statelist'] = xarModAPIFunc('publications', 'user', 'getstates');
    $data['fields'] = array('pubtype_id' => xarML('Publication Type'), 'state' => xarML('Status'), 'owner' => xarML('Author'), 'pubdate_year' => xarML('Publication Year'), 'pubdate_month' => xarML('Publication Month'), 'pubdate_day' => xarML('Publication Day'), 'locale' => xarML('Language'));
    return $data;
}
开发者ID:godboko,项目名称:modules,代码行数:33,代码来源:stats.php


示例5: publications_userapi_getitemlinks

/**
 * utility function to pass individual item links to a caller
 *
 * @param $args['itemids'] array of item ids to get
 * @return array Array containing the itemlink(s) for the item(s).
 */
function publications_userapi_getitemlinks($args)
{
    $itemlinks = array();
    sys::import('xaraya.structures.query');
    $xartable = xarDB::getTables();
    $q = new Query('SELECT', $xartable['publications']);
    $q->addfield('id');
    $q->addfield('title');
    $q->addfield('description');
    $q->addfield('pubtype_id');
    $q->in('state', array(3, 4));
    if (!empty($args['itemids'])) {
        $itemids = explode(',', $args['itemids']);
        $q->in('id', $itemids);
    }
    $q->addorder('title');
    $q->run();
    $result = $q->output();
    if (empty($result)) {
        return $itemlinks;
    }
    foreach ($result as $item) {
        if (empty($item['title'])) {
            $item['title'] = xarML('Display Publication');
        }
        $itemlinks[$item['id']] = array('url' => xarModURL('publications', 'user', 'display', array('id' => $item['id'])), 'title' => $item['title'], 'label' => $item['description']);
    }
    return $itemlinks;
}
开发者ID:godboko,项目名称:modules,代码行数:35,代码来源:getitemlinks.php


示例6: shop_admin_modifycustomer

/**
 *  Modify a customer
 */
function shop_admin_modifycustomer()
{
    if (!xarVarFetch('itemid', 'id', $data['itemid'], NULL, XARVAR_DONT_SET)) {
        return;
    }
    if (!xarVarFetch('confirm', 'bool', $data['confirm'], false, XARVAR_NOT_REQUIRED)) {
        return;
    }
    $objectname = 'shop_customers';
    $data['objectname'] = $objectname;
    // Check if we still have no id of the item to modify.
    if (empty($data['itemid'])) {
        $msg = xarML('Invalid #(1) for #(2) function #(3)() in module #(4)', 'item id', 'admin', 'modify', 'shop');
        throw new Exception($msg);
    }
    if (!xarSecurityCheck('AdminShop', 1, 'Item', $data['itemid'])) {
        return;
    }
    sys::import('modules.dynamicdata.class.objects.master');
    $object = DataObjectMaster::getObject(array('name' => $objectname));
    $data['object'] = $object;
    $data['label'] = $object->label;
    $object->getItem(array('itemid' => $data['itemid']));
    $values = $object->getFieldValues();
    foreach ($values as $name => $value) {
        $data[$name] = xarVarPrepForDisplay($value);
    }
    $rolesobject = DataObjectMaster::getObject(array('name' => 'roles_users'));
    $rolesobject->getItem(array('itemid' => $data['itemid']));
    if ($data['confirm']) {
        // Check for a valid confirmation key
        if (!xarSecConfirmAuthKey()) {
            return xarTplModule('privileges', 'user', 'errors', array('layout' => 'bad_author'));
        }
        // Get the data from the form
        $isvalid = $object->checkInput();
        if (!$isvalid) {
            // Bad data: redisplay the form with the data we picked up and with error messages
            return xarTplModule('shop', 'admin', 'modifycustomer', $data);
        } elseif (isset($data['preview'])) {
            // Show a preview, same thing as the above essentially
            return xarTplModule('shop', 'admin', 'modifycustomer', $data);
        } else {
            $first_name = $object->properties['first_name']->getValue();
            $last_name = $object->properties['last_name']->getValue();
            $rolesobject->properties['name']->setValue($first_name . ' ' . $last_name);
            $rolesobject->updateItem();
            $object->updateItem();
            // Jump to the next page
            xarResponse::redirect(xarModURL('shop', 'admin', 'modifycustomer', array('itemid' => $data['itemid'])));
            return $data;
        }
    } else {
        // Get that specific item of the object
        $object->getItem(array('itemid' => $data['itemid']));
    }
    // Return the template variables defined in this function
    return $data;
}
开发者ID:godboko,项目名称:modules,代码行数:62,代码来源:modifycustomer.php


示例7: calendar_adminapi_create_calendars

/**
 * @returns int (calendar id on success, false on failure)
 */
function calendar_adminapi_create_calendars($args)
{
    extract($args);
    // argument check
    if (!isset($calname)) {
        $msg = xarML('Calendar name not specified', 'admin', 'create', 'calendar');
        throw new Exception($msg);
    }
    // TODO: should I move these two issets to the admin function
    // admin/create_calendars.php? --amoro
    if (!isset($mod_id)) {
        $module = xarController::$request->getInfo();
        $mod_id = xarMod::getRegID($module[0]);
    }
    if (!isset($role_id)) {
        $role_id = xarSession::getVar('role_id');
    }
    // Load up database details.
    $dbconn = xarDB::getConn();
    $xartable = xarDB::getTables();
    $caltable = $xartable['calendars'];
    // Insert instance details.
    $nextId = $dbconn->GenId($caltable);
    $query = 'INSERT INTO ' . $caltable . ' (
              xar_id,
              xar_role_id,
              xar_mod_id,
              xar_name
            ) VALUES (?, ?, ?, ?)';
    $result =& $dbconn->Execute($query, array($nextId, $role_id, $mod_id, $calname));
    if (!$result) {
        return;
    }
    // Get ID of row inserted.
    $calendid = $dbconn->PO_Insert_ID($caltable, 'xar_id');
    // If not database type also add file info
    // Allow duplicate files here, to make it easier to delete them
    // WARNING: if somebody changes this you should also change the
    // delete function to avoid major dataloss!!! --amoro
    if ($addtype != 'db') {
        $filestable = $xartable['calfiles'];
        $cal_filestable = $xartable['calendars_files'];
        $nextID = $dbconn->GenId($filestable);
        $query = 'INSERT INTO ' . $filestable . ' (
                  xar_id,
                  xar_path
                ) VALUES (?, ?)';
        $result =& $dbconn->Execute($query, array($nextID, $fileuri));
        // Get ID of row inserted.
        $fileid = $dbconn->PO_Insert_ID($filestable, 'xar_id');
        $query = 'INSERT INTO ' . $cal_filestable . ' (
                      xar_calendars_id,
                      xar_files_id
                    ) VALUES (?, ?)';
        $result =& $dbconn->Execute($query, array($calendid, $fileid));
    }
    return $calendid;
}
开发者ID:godboko,项目名称:modules,代码行数:61,代码来源:create_calendars.php


示例8: publications_adminapi_createpubtype

/**
 * Create a new publication type
 *
 * @param $args['name'] name of the publication type
 * @param $args['descr'] description of the publication type
 * @param $args['config'] configuration of the publication type
 * @return int publication type ID on success, false on failure
 */
function publications_adminapi_createpubtype($args)
{
    // Get arguments from argument array
    extract($args);
    // Argument check - make sure that all required arguments are present
    // and in the right format, if not then set an appropriate error
    // message and return
    // Note : since we have several arguments we want to check here, we'll
    // report all those that are invalid at the same time...
    $invalid = array();
    if (!isset($name) || !is_string($name) || empty($name)) {
        $invalid[] = 'name';
    }
    if (!isset($config) || !is_array($config) || count($config) == 0) {
        $invalid[] = 'configuration';
    }
    if (count($invalid) > 0) {
        $msg = xarML('Invalid #(1) for #(2) function #(3)() in module #(4)', join(', ', $invalid), 'admin', 'createpubtype', 'Publications');
        throw new BadParameterException(null, $msg);
    }
    if (empty($descr)) {
        $descr = $name;
    }
    // Publication type names *must* be lower-case for now
    $name = strtolower($name);
    // Security check - we require ADMIN rights here
    if (!xarSecurityCheck('AdminPublications')) {
        return;
    }
    if (!xarModAPILoad('publications', 'user')) {
        return;
    }
    // Make sure we have all the configuration fields we need
    $pubfields = xarModAPIFunc('publications', 'user', 'getpubfields');
    foreach ($pubfields as $field => $value) {
        if (!isset($config[$field])) {
            $config[$field] = '';
        }
    }
    // Get database setup
    $dbconn = xarDB::getConn();
    $xartable = xarDB::getTables();
    $pubtypestable = $xartable['publication_types'];
    // Get next ID in table
    $nextId = $dbconn->GenId($pubtypestable);
    // Insert the publication type
    $query = "INSERT INTO {$pubtypestable} (pubtype_id, pubtypename,\n            pubtypedescr, pubtypeconfig)\n            VALUES (?,?,?,?)";
    $bindvars = array($nextId, $name, $descr, serialize($config));
    $result =& $dbconn->Execute($query, $bindvars);
    if (!$result) {
        return;
    }
    // Get ptid to return
    $ptid = $dbconn->PO_Insert_ID($pubtypestable, 'pubtype_id');
    // Don't call creation hooks here...
    //xarModCallHooks('item', 'create', $ptid, 'ptid');
    return $ptid;
}
开发者ID:godboko,项目名称:modules,代码行数:66,代码来源:createpubtype.php


示例9: modify

 function modify()
 {
     $data = $this->getContent();
     $data['fields'] = array('id', 'name');
     if (!is_array($data['pubstate'])) {
         $statearray = array($data['pubstate']);
     } else {
         $statearray = $data['pubstate'];
     }
     if (!empty($data['catfilter'])) {
         $cidsarray = array($data['catfilter']);
     } else {
         $cidsarray = array();
     }
     // Create array based on modifications
     $article_args = array();
     // Only include pubtype if a specific pubtype is selected
     if (!empty($data['pubtype_id'])) {
         $article_args['ptid'] = $data['pubtype_id'];
     }
     // If itemlimit is set to 0, then don't pass to getall
     if ($data['itemlimit'] != 0) {
         $article_args['numitems'] = $data['itemlimit'];
     }
     // Add the rest of the arguments
     $article_args['cids'] = $cidsarray;
     $article_args['enddate'] = time();
     $article_args['state'] = $statearray;
     $article_args['fields'] = $data['fields'];
     $article_args['sort'] = $data['toptype'];
     $data['filtereditems'] = xarModAPIFunc('publications', 'user', 'getall', $article_args);
     // Check for exceptions
     //    if (!isset($vars['filtereditems']) && xarCurrentErrorType() != XAR_NO_EXCEPTION)
     //        return; // throw back
     // Try to keep the additional headlines select list width less than 50 characters
     for ($idx = 0; $idx < count($data['filtereditems']); $idx++) {
         if (strlen($data['filtereditems'][$idx]['title']) > 50) {
             $data['filtereditems'][$idx]['title'] = substr($data['filtereditems'][$idx]['title'], 0, 47) . '...';
         }
     }
     $data['pubtypes'] = xarModAPIFunc('publications', 'user', 'get_pubtypes');
     $data['categorylist'] = xarModAPIFunc('categories', 'user', 'getcat');
     $data['stateoptions'] = array(array('id' => '', 'name' => xarML('All Published')), array('id' => '3', 'name' => xarML('Frontpage')), array('id' => '2', 'name' => xarML('Approved')));
     $data['sortoptions'] = array(array('id' => 'author', 'name' => xarML('Author')), array('id' => 'date', 'name' => xarML('Date')), array('id' => 'hits', 'name' => xarML('Hit Count')), array('id' => 'rating', 'name' => xarML('Rating')), array('id' => 'title', 'name' => xarML('Title')));
     //Put together the additional featured publications list
     for ($idx = 0; $idx < count($data['filtereditems']); ++$idx) {
         $data['filtereditems'][$idx]['selected'] = '';
         for ($mx = 0; $mx < count($data['moreitems']); ++$mx) {
             if ($data['moreitems'][$mx] == $data['filtereditems'][$idx]['id']) {
                 $data['filtereditems'][$idx]['selected'] = 'selected';
             }
         }
     }
     $data['morepublications'] = $data['filtereditems'];
     return $data;
 }
开发者ID:godboko,项目名称:modules,代码行数:56,代码来源:featureditems_admin.php


示例10: publications_admin_importpubtype

/**
 * Import an object definition or an object item from XML
 */
function publications_admin_importpubtype($args)
{
    if (!xarSecurityCheck('AdminPublications')) {
        return;
    }
    if (!xarVarFetch('import', 'isset', $import, NULL, XARVAR_DONT_SET)) {
        return;
    }
    if (!xarVarFetch('xml', 'isset', $xml, NULL, XARVAR_DONT_SET)) {
        return;
    }
    extract($args);
    $data = array();
    $data['menutitle'] = xarML('Dynamic Data Utilities');
    $data['warning'] = '';
    $data['options'] = array();
    $basedir = 'modules/publications';
    $filetype = 'xml';
    $files = xarModAPIFunc('dynamicdata', 'admin', 'browse', array('basedir' => $basedir, 'filetype' => $filetype));
    if (!isset($files) || count($files) < 1) {
        $files = array();
        $data['warning'] = xarML('There are currently no XML files available for import in "#(1)"', $basedir);
    }
    if (!empty($import) || !empty($xml)) {
        if (!xarSecConfirmAuthKey()) {
            return;
        }
        if (!empty($import)) {
            $found = '';
            foreach ($files as $file) {
                if ($file == $import) {
                    $found = $file;
                    break;
                }
            }
            if (empty($found) || !file_exists($basedir . '/' . $file)) {
                $msg = xarML('File not found');
                throw new BadParameterException(null, $msg);
            }
            $ptid = xarModAPIFunc('publications', 'admin', 'importpubtype', array('file' => $basedir . '/' . $file));
        } else {
            $ptid = xarModAPIFunc('publications', 'admin', 'importpubtype', array('xml' => $xml));
        }
        if (empty($ptid)) {
            return;
        }
        $data['warning'] = xarML('Publication type #(1) was successfully imported', $ptid);
    }
    natsort($files);
    array_unshift($files, '');
    foreach ($files as $file) {
        $data['options'][] = array('id' => $file, 'name' => $file);
    }
    $data['authid'] = xarSecGenAuthKey();
    return $data;
}
开发者ID:godboko,项目名称:modules,代码行数:59,代码来源:importpubtype.php


示例11: xarML

/**
* get array of field formats for publication types
* @TODO : move this to some common place in Xaraya (base module ?)
* + replace with dynamic_propertytypes table
*
* + extend with other pre-defined formats
* @return array('static'  => xarML('Static Text'),
                'textbox' => xarML('Text Box'),
                ...);
*/
function publications_userapi_getpubfieldformats($args)
{
    $fieldlist = array('static' => xarML('Static Text'), 'textbox' => xarML('Text Box'), 'textarea' => xarML('Small Text Area'), 'textarea_medium' => xarML('Medium Text Area'), 'textarea_large' => xarML('Large Text Area'), 'dropdown' => xarML('Dropdown List'), 'textupload' => xarML('Text Upload'), 'fileupload' => xarML('File Upload'), 'url' => xarML('URL'), 'urltitle' => xarML('URL + Title'), 'image' => xarML('Image'), 'imagelist' => xarML('Image List'), 'calendar' => xarML('Calendar'), 'webpage' => xarML('HTML Page'), 'username' => xarML('Username'), 'userlist' => xarML('User List'), 'state' => xarML('Status'), 'locale' => xarML('Language List'));
    // Add  'text' dd properites that are dependent on module availability
    $extrafields = array();
    if (xarModIsAvailable('tinymce')) {
        $extrafields = array('tinymce' => xarML('TinyMCE GUI'));
        $fieldlist = array_merge($fieldlist, $extrafields);
    }
    return $fieldlist;
}
开发者ID:godboko,项目名称:modules,代码行数:21,代码来源:getpubfieldformats.php


示例12: calendar_adminapi_hookcreate

function calendar_adminapi_hookcreate($data)
{
    if (!isset($data['extrainfo']) || !is_array($data['extrainfo'])) {
        $data['extrainfo'] = array();
    }
    // When called via hooks, modname will be empty, but we get it from the
    // extrainfo or the current module
    if (empty($data['module'])) {
        if (!empty($data['extrainfo']['module'])) {
            $data['module'] = $data['extrainfo']['module'];
        } else {
            $data['module'] = xarMod::getName();
        }
    }
    $data['module_id'] = xarMod::getID($data['module']);
    if (empty($data['module_id'])) {
        throw new IDNotFoundException("module id for " . $data['modname']);
    }
    if (!isset($data['itemtype']) || !is_numeric($data['itemtype'])) {
        if (isset($data['extrainfo']['itemtype']) && is_numeric($data['extrainfo']['itemtype'])) {
            $data['itemtype'] = $data['extrainfo']['itemtype'];
        } else {
            $data['itemtype'] = 0;
        }
    }
    if (!isset($data['itemid']) || !is_numeric($data['itemid'])) {
        if (isset($data['extrainfo']['item_id']) && is_numeric($data['extrainfo']['item_id'])) {
            $data['itemid'] = $data['extrainfo']['item_id'];
        } else {
            $data['itemid'] = 0;
        }
    }
    $data['extrainfo']['module_id'] = $data['module_id'];
    $data['extrainfo']['itemtype'] = $data['itemtype'];
    $data['extrainfo']['item_id'] = $data['itemid'];
    $data['extrainfo']['name'] = isset($data['extrainfo']['name']) ? $data['extrainfo']['name'] : xarML('Unknown Event');
    $data['extrainfo']['start_time'] = isset($data['extrainfo']['start_time']) ? $data['extrainfo']['start_time'] : time();
    $data['extrainfo']['duration'] = isset($data['extrainfo']['duration']) ? $data['extrainfo']['duration'] : 60;
    $data['extrainfo']['end_time'] = isset($data['extrainfo']['end_time']) ? $data['extrainfo']['end_time'] : $data['extrainfo']['start_time'] + $data['extrainfo']['duration'];
    $data['extrainfo']['recurring_code'] = isset($data['extrainfo']['recurring_code']) ? $data['extrainfo']['recurring_code'] : 0;
    $data['extrainfo']['recurring_span'] = isset($data['extrainfo']['recurring_span']) ? $data['extrainfo']['recurring_span'] : 0;
    $data['extrainfo']['start_location'] = isset($data['extrainfo']['start_location']) ? $data['extrainfo']['start_location'] : null;
    $data['extrainfo']['end_location'] = isset($data['extrainfo']['end_location']) ? $data['extrainfo']['end_location'] : null;
    $data['extrainfo']['object_id'] = isset($data['extrainfo']['object_id']) ? $data['extrainfo']['object_id'] : 0;
    $data['extrainfo']['role_id'] = isset($data['extrainfo']['role_id']) ? $data['extrainfo']['role_id'] : xarSession::getVar('role_id');
    $data['extrainfo']['return_link'] = isset($data['extrainfo']['return_link']) ? $data['extrainfo']['return_link'] : '';
    $data['extrainfo']['state'] = isset($data['extrainfo']['state']) ? $data['extrainfo']['state'] : 3;
    $data['extrainfo']['timestamp'] = isset($data['extrainfo']['timestamp']) ? $data['extrainfo']['timestamp'] : time();
    $data['extrainfo']['itemid'] = 0;
    $object = DataObjectMaster::getObject(array('name' => 'calendar_event'));
    $item = $object->createItem($data['extrainfo']);
    return $data['extrainfo'];
}
开发者ID:godboko,项目名称:modules,代码行数:53,代码来源:hookcreate.php


示例13: calendar_adminapi_menu

/**
 * generate the common admin menu configuration
 */
function calendar_adminapi_menu()
{
    // Initialise the array that will hold the menu configuration
    $menu = array();
    // Specify the menu title to be used in your blocklayout template
    $menu['menutitle'] = xarML('Calendar Administration');
    // Specify the menu labels to be used in your blocklayout template
    // Preset some status variable
    $menu['status'] = '';
    // Return the array containing the menu configuration
    return $menu;
}
开发者ID:godboko,项目名称:modules,代码行数:15,代码来源:menu.php


示例14: calendar_admin_create_calendars

function calendar_admin_create_calendars()
{
    // Get parameters
    // TODO HELPNEEDED here: how do I handle this (e.g. missing calname should return a
    // message
    if (!xarVarFetch('add_calendar', 'isset', $add_calendar)) {
        return;
    }
    if (!xarVarFetch('calname', 'str:1:', $calname)) {
        return;
    }
    if (!xarVarFetch('addtype', 'str:1:', $addtype)) {
        return;
    }
    if (!xarVarFetch('location', 'str:1:', $location, '', XARVAR_NOT_REQUIRED)) {
        return;
    }
    if (!xarVarFetch('uri', 'str:1:', $uri, '', XARVAR_NOT_REQUIRED)) {
        return;
    }
    // Confirm Auth Key
    if (!xarSecConfirmAuthKey()) {
        return;
    }
    // Security Check
    // TODO
    //    if(!xarSecurityCheck('AddCalendar', 0, 'Calendar')) {return;}
    // Check if module name has already been used.
    $checkname = xarMod::apiFunc('calendar', 'user', 'get', array('calname' => $calname));
    if (!empty($checkname)) {
        $msg = xarML('Calendar name "#(1)" already exists. Please go back and enter a
                      different name', $calname);
        throw new Exception($msg);
    }
    if ($addtype == 'db') {
        $fileuri = 'a';
    } elseif ($addtype == 'file') {
        $fileuri = $location;
    } elseif ($addtype == 'uri') {
        $fileuri = $uri;
    }
    // Pass to API
    $calid = xarMod::apiFunc('calendar', 'admin', 'create_calendars', array('calname' => $calname, 'fileuri' => $fileuri, 'addtype' => $addtype));
    if (!$calid) {
        return;
    }
    // Go on and edit the new instance
    xarController::redirect(xarModURL('calendar', 'admin', 'add_calendars', array('calid' => $calid, 'calname' => $calname)));
}
开发者ID:godboko,项目名称:modules,代码行数:49,代码来源:create_calendars.php


示例15: publications_adminapi_getpubtypeaccess

function publications_adminapi_getpubtypeaccess($args)
{
    if (!isset($args['ptid'])) {
        throw new Exception(xarML('Missing ptid param in publications_adminapi_getpubtypeaccess'));
    }
    $pubtypeobject = DataObjectMaster::getObject(array('name' => 'publications_types'));
    if (null == $pubtypeobject) {
        return false;
    }
    $pubtypeobject->getItem(array('itemid' => $args['ptid']));
    if (empty($pubtypeobject->properties['access']->value)) {
        return "a:0:{}";
    }
    return $pubtypeobject->properties['access']->value;
}
开发者ID:godboko,项目名称:modules,代码行数:15,代码来源:getpubtypeaccess.php


示例16: publications_adminapi_deletepubtype

/**
 * Delete a publication type
 *
 * @param $args['ptid'] ID of the publication type
 * @return bool true on success, false on failure
 */
function publications_adminapi_deletepubtype($args)
{
    // Get arguments from argument array
    extract($args);
    // Argument check - make sure that all required arguments are present
    // and in the right format, if not then set an appropriate error
    // message and return
    if (!isset($ptid) || !is_numeric($ptid) || $ptid < 1) {
        $msg = xarML('Invalid #(1) for #(2) function #(3)() in module #(4)', 'publication type ID', 'admin', 'deletepubtype', 'Publications');
        throw new BadParameterException(null, $msg);
    }
    // Security check - we require ADMIN rights here
    if (!xarSecurityCheck('AdminPublications', 1, 'Publication', "{$ptid}:All:All:All")) {
        return;
    }
    // Load user API to obtain item information function
    if (!xarModAPILoad('publications', 'user')) {
        return;
    }
    // Get current publication types
    $pubtypes = xarModAPIFunc('publications', 'user', 'get_pubtypes');
    if (!isset($pubtypes[$ptid])) {
        $msg = xarML('Invalid #(1) for #(2) function #(3)() in module #(4)', 'publication type ID', 'admin', 'deletepubtype', 'Publications');
        throw new BadParameterException(null, $msg);
    }
    // Get database setup
    $dbconn = xarDB::getConn();
    $xartable = xarDB::getTables();
    $pubtypestable = $xartable['publication_types'];
    // Delete the publication type
    $query = "DELETE FROM {$pubtypestable}\n            WHERE pubtype_id = ?";
    $result =& $dbconn->Execute($query, array($ptid));
    if (!$result) {
        return;
    }
    $publicationstable = $xartable['publications'];
    // Delete all publications for this publication type
    $query = "DELETE FROM {$publicationstable}\n            WHERE pubtype_id = ?";
    $result =& $dbconn->Execute($query, array($ptid));
    if (!$result) {
        return;
    }
    // TODO: call some kind of itemtype delete hooks here, once we have those
    //xarModCallHooks('itemtype', 'delete', $ptid,
    //                array('module' => 'publications',
    //                      'itemtype' =>'ptid'));
    return true;
}
开发者ID:godboko,项目名称:modules,代码行数:54,代码来源:deletepubtype.php


示例17: publications_user_redirect

/**
 * redirect to a site based on some URL field of the item
 */
function publications_user_redirect($args)
{
    // Get parameters from user
    if (!xarVarFetch('id', 'id', $id, NULL, XARVAR_NOT_REQUIRED)) {
        return;
    }
    // Override if needed from argument array
    extract($args);
    if (!isset($id) || !is_numeric($id) || $id < 1) {
        return xarML('Invalid publication ID');
    }
    // Load API
    if (!xarModAPILoad('publications', 'user')) {
        return;
    }
    // Get publication
    $publication = xarModAPIFunc('publications', 'user', 'get', array('id' => $id));
    if (!is_array($publication)) {
        $msg = xarML('Failed to retrieve publication in #(3)_#(1)_#(2).php', 'user', 'get', 'publications');
        throw new DataNotFoundException(null, $msg);
    }
    $ptid = $publication['pubtype_id'];
    // Get publication types
    $pubtypes = xarModAPIFunc('publications', 'user', 'get_pubtypes');
    // TODO: improve this e.g. when multiple URL fields are present
    // Find an URL field based on the pubtype configuration
    foreach ($pubtypes[$ptid]['config'] as $field => $value) {
        if (empty($value['label'])) {
            continue;
        }
        if ($value['format'] == 'url' && !empty($publication[$field]) && $publication[$field] != 'http://') {
            // TODO: add some verifications here !
            $hooks = xarModCallHooks('item', 'display', $id, array('module' => 'publications', 'itemtype' => $ptid), 'publications');
            xarController::redirect($article[$field]);
            return true;
        } elseif ($value['format'] == 'urltitle' && !empty($publication[$field]) && substr($publication[$field], 0, 2) == 'a:') {
            $array = unserialize($publication[$field]);
            if (!empty($array['link']) && $array['link'] != 'http://') {
                $hooks = xarModCallHooks('item', 'display', $id, array('module' => 'publications', 'itemtype' => $ptid), 'publications');
                xarController::redirect($array['link']);
                return true;
            }
        }
    }
    return xarML('Unable to find valid redirect field');
}
开发者ID:godboko,项目名称:modules,代码行数:49,代码来源:redirect.php


示例18: calendar_admin_add_calendars

function calendar_admin_add_calendars()
{
    // Security check
    //    if (!xarSecurityCheck('AddCalendar',0,'Calendar')) return;
    if (!xarVarFetch('calid', 'int:0:', $calid, '0', XARVAR_NOT_REQUIRED)) {
        return;
    }
    if (!xarVarFetch('calname', 'str', $calname, '', XARVAR_NOT_REQUIRED)) {
        return;
    }
    $data = xarMod::apiFunc('calendar', 'admin', 'get_calendars');
    // Generate a one-time authorisation code for this operation
    $data['authid'] = xarSecGenAuthKey();
    $data['default_cal'] = unserialize(xarModVars::get('calendar', 'default_cal'));
    $data['addbutton'] = xarVarPrepForDisplay(xarML('Add calendar'));
    $data['message'] = xarVarPrepForDisplay(xarML('Created calendar with name "#(1)", ID #(2)', $calname, $calid));
    $data['calid'] = $calid;
    return $data;
}
开发者ID:godboko,项目名称:modules,代码行数:19,代码来源:add_calendars.php


示例19: modify

 function modify()
 {
     $data = $this->getContent();
     if (!is_array($data['pubstate'])) {
         $statearray = array($data['pubstate']);
     } else {
         $statearray = $data['pubstate'];
     }
     // Only include pubtype if a specific pubtype is selected
     if (!empty($data['pubtype_id'])) {
         $article_args['ptid'] = $data['pubtype_id'];
     }
     // Add the rest of the arguments
     $article_args['state'] = $statearray;
     $data['filtereditems'] = xarModAPIFunc('publications', 'user', 'getall', $article_args);
     $data['pubtypes'] = xarModAPIFunc('publications', 'user', 'get_pubtypes');
     $data['stateoptions'] = array(array('id' => '', 'name' => xarML('All Published')), array('id' => '3', 'name' => xarML('Frontpage')), array('id' => '2', 'name' => xarML('Approved')));
     return $data;
 }
开发者ID:godboko,项目名称:modules,代码行数:19,代码来源:filler_admin.php


示例20: shop_user_product

/**
 * Display a product
 */
function shop_user_product($args)
{
    if (!xarVarFetch('itemid', 'id', $itemid, NULL, XARVAR_DONT_SET)) {
        return;
    }
    extract($args);
    if (!empty($objectid)) {
        $itemid = $objectid;
    }
    if (empty($itemid)) {
        $msg = xarML('Invalid #(1) for #(2) function #(3)() in module #(4)', 'item id', 'user', 'display', 'shop');
        throw new Exception($msg);
    }
    // Make sure user has read privileges for the item
    if (!xarSecurityCheck('ReadShop', 1, 'Item', $itemid)) {
        return;
    }
    // Load the DD master object class. This line will likely disappear in future versions
    sys::import('modules.dynamicdata.class.objects.master');
    // Get the object definition we'll be working with
    $object = DataObjectMaster::getObject(array('name' => 'shop_products'));
    $data['object'] = $object;
    //We don't really have the item until we call getItem()
    $some_id = $object->getItem(array('itemid' => $itemid));
    //Make sure we got something
    if (!isset($some_id) || $some_id != $itemid) {
        return;
    }
    //Get the property names and values for the item with the getFieldValues() method
    $values = $object->getFieldValues();
    $data['itemid'] = $itemid;
    //$values is an associative array of property names and values, so...
    foreach ($values as $name => $value) {
        $data[$name] = xarVarPrepForDisplay($value);
    }
    $data['editurl'] = '';
    if (xarSecurityCheck('EditShop', 1)) {
        $data['editurl'] = xarModURL('shop', 'admin', 'modify', array('itemid' => $itemid, 'name' => 'shop_products'));
    }
    return xarTplModule('shop', 'user', 'product', $data);
}
开发者ID:godboko,项目名称:modules,代码行数:44,代码来源:product.php



注:本文中的xarML函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP xarModAPIFunc函数代码示例发布时间:2022-05-23
下一篇:
PHP xapp_import函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap