本文整理汇总了PHP中ModUtil::apiFunc方法的典型用法代码示例。如果您正苦于以下问题:PHP ModUtil::apiFunc方法的具体用法?PHP ModUtil::apiFunc怎么用?PHP ModUtil::apiFunc使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ModUtil
的用法示例。
在下文中一共展示了ModUtil::apiFunc方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Construct.
*
* @param int $objectId Object ID.
* @param int $areaId A blockinfo structure.
* @param string $module Module.
* @param string $urlString Url.
* @param Zikula_ModUrl $urlObject Url object.
*/
function __construct($objectId, $areaId, $module, $urlString = null, Zikula_ModUrl $urlObject = null)
{
parent::__construct($objectId, $areaId, $module, $urlString, $urlObject);
$args = $urlObject->getArgs();
$ot = $args['ot'];
if ($ot == 'posting') {
$posting = ModUtil::apiFunc('MUBoard', 'selection', 'getEntity', array('ot' => 'posting', 'id' => $this->getObjectId()));
// the Api checks for perms and there is nothing else to check
if ($posting) {
$userid = $posting->getCreatedUserId();
$date = $posting->getCreatedDate();
$title = $posting->getTitle();
$this->setObjectAuthor(UserUtil::getVar('uname', $userid));
$this->setObjectDate($date);
$this->setObjectTitle($title);
}
}
if ($ot == 'picture') {
$picture = ModUtil::apiFunc('MUImage', 'selection', 'getEntity', array('ot' => 'picture', 'id' => $this->getObjectId()));
// the Api checks for perms and there is nothing else to check
if ($picture) {
$userid = $picture->getCreatedUserId();
$date = $picture->getCreatedDate();
$title = $picture->getTitle();
$this->setObjectAuthor(UserUtil::getVar('uname', $userid));
$this->setObjectDate($date);
$this->setObjectTitle($title);
}
}
}
示例2: smarty_function_nextpostlink
/**
* Smarty function to display a link to the next post
*
* Example
* <!--[nextpostlink sid=$info.sid layout='%link% <span class="news_metanav">»</span>']-->
*
* @author Mark West
* @since 20/10/03
* @see function.nextpostlink.php::smarty_function_nextpostlink()
* @param array $params All attributes passed to this function from the template
* @param object &$smarty Reference to the Smarty object
* @param integer $sid article id
* @param string $layout HTML string in which to insert link
* @return string the results of the module function
*/
function smarty_function_nextpostlink($params, &$smarty)
{
if (!isset($params['sid'])) {
// get the info template var
$info = $smarty->get_template_vars('info');
$params['sid'] = $info['sid'];
}
if (!isset($params['layout'])) {
$params['layout'] = '%link% <span class="news_metanav">»</span>';
}
$article = ModUtil::apiFunc('News', 'user', 'getall',
array('query' => array(array('sid', '>', $params[sid])),
'orderdir' => 'ASC',
'numitems' => 1));
if (!$article) {
return;
}
$articlelink = '<a href="'.DataUtil::formatForDisplay(ModUtil::url('News', 'user', 'display', array('sid' => $article[0]['sid']))).'">'.DataUtil::formatForDisplay($article[0]['title']).'</a>';
$articlelink = str_replace('%link%', $articlelink, $params['layout']);
if (isset($params['assign'])) {
$smarty->assign($params['assign'], $articlelink);
} else {
return $articlelink;
}
}
示例3: EZComments_migrateapi_pnFlashGames
/**
* Do the migration
*
* With this function, the actual migration is done.
*
* @return boolean true on sucessful migration, false else
* @since 0.2
*/
function EZComments_migrateapi_pnFlashGames()
{
// Security check
if (!SecurityUtil::checkPermission('EZComments::', '::', ACCESS_ADMIN)) {
return LogUtil::registerError('pnFlashGames comments migration: Not Admin');
}
// Get datbase setup
$tables = DBUtil::getTables();
$Commentstable = $tables['pnFlashGames_comments'];
$Commentscolumn = $tables['pnFlashGames_comments_column'];
$Usertable = $tables['users'];
$Usercolumn = $tables['users_column'];
$sql = "SELECT {$Commentscolumn['gid']},\n {$Commentscolumn['uname']},\n {$Commentscolumn['date']},\n {$Commentscolumn['comment']},\n {$Usercolumn['uid']}\n FROM {$Commentstable}\n LEFT JOIN {$Usertable}\n ON {$Commentscolumn['uname']} = {$Usercolumn['uname']}";
$result = DBUtil::executeSQL($sql);
if ($result == false) {
return LogUtil::registerError('pnFlashGames migration: DB Error: ' . $sql . ' -- ' . mysql_error());
}
// loop through the old comments and insert them one by one into the DB
$items = DBUtil::marshalObjects($result, array('gid', 'uname', 'date', 'comment', 'uid'));
foreach ($items as $item) {
// set the correct user id for anonymous users
if (empty($item['uid'])) {
$item['uid'] = 1;
}
$id = ModUtil::apiFunc('EZComments', 'user', 'create', array('mod' => 'pnFlashGames', 'objectid' => DataUtil::formatForStore($item['gid']), 'url' => ModUtil::url('pnFlashGames', 'user', 'display', array('id' => $item['gid'])), 'comment' => $item['comment'], 'subject' => '', 'uid' => $item['uid'], 'date' => $item['date']));
if (!$id) {
return LogUtil::registerError('pnFlashGames migration: Error creating comment');
}
}
return LogUtil::registerStatus('pnFlashGames migration successful');
}
示例4: smarty_function_html_select_modulestylesheets
/**
* Zikula_View function to display a drop down list of module stylesheets.
*
* Available parameters:
* - modname The module name to show the styles for
* - assign: If set, the results are assigned to the corresponding variable instead of printed out
* - id: ID for the control
* - name: Name for the control
* - exclude Comma seperated list of files to exclude (optional)
* - selected: Selected value
*
* @param array $params All attributes passed to this function from the template.
* @param Zikula_View $view Reference to the Zikula_View object.
*
* @return string The value of the last status message posted, or void if no status message exists.
*/
function smarty_function_html_select_modulestylesheets($params, Zikula_View $view)
{
if (!isset($params['modname'])) {
$view->trigger_error(__f('Error! in %1$s: the %2$s parameter must be specified.', array('html_select_modulestylesheets', 'modname')));
return false;
}
if (isset($params['exclude'])) {
$exclude = explode(',', trim($params['exclude']));
unset($params['exclude']);
} else {
$exclude = array();
}
$params['values'] = ModUtil::apiFunc('ZikulaAdminModule', 'admin', 'getmodstyles', array('modname' => $params['modname'], 'exclude' => $exclude));
unset($params['modname']);
$params['output'] = $params['values'];
$assign = isset($params['assign']) ? $params['assign'] : null;
unset($params['assign']);
require_once $view->_get_plugin_filepath('function', 'html_options');
$output = smarty_function_html_options($params, $view);
if (!empty($assign)) {
$view->assign($assign, $output);
} else {
return $output;
}
}
示例5: content_needleapi_content
/**
* Content needle
* @param $args['nid'] needle id
* @return array()
*/
function content_needleapi_content($args)
{
$dom = ZLanguage::getModuleDomain('Content');
// Get arguments from argument array
$nid = $args['nid'];
unset($args);
// cache the results
static $cache;
if (!isset($cache)) {
$cache = array();
}
if (!empty($nid)) {
if (!isset($cache[$nid])) {
// not in cache array
if (ModUtil::available('Content')) {
$contentpage = ModUtil::apiFunc('Content', 'Page', 'getPage', array('id' => $nid, 'includeContent' => false));
if ($contentpage != false) {
$cache[$nid] = '<a href="' . DataUtil::formatForDisplay(ModUtil::url('Content', 'user', 'view', array('pid' => $nid))) . '" title="' . DataUtil::formatForDisplay($contentpage['title']) . '">' . DataUtil::formatForDisplay($contentpage['title']) . '</a>';
} else {
$cache[$nid] = '<em>' . DataUtil::formatForDisplay(__('Unknown id', $dom)) . '</em>';
}
} else {
$cache[$nid] = '<em>' . DataUtil::formatForDisplay(__('Content not available', $dom)) . '</em>';
}
}
$result = $cache[$nid];
} else {
$result = '<em>' . DataUtil::formatForDisplay(__('No needle id', $dom)) . '</em>';
}
return $result;
}
示例6: smarty_function_modapifunc
/**
* Zikula_View function to to execute a module API function
*
* This function calls a calls a specific module API function. It returns whatever the return
* value of the resultant function is if it succeeds.
* Note that in contrast to the API function ModUtil::apiFunc you need not to load the
* module API with ModUtil::loadApi.
*
*
* Available parameters:
* - modname: The well-known name of a module to execute a function from (required)
* - type: The type of function to execute; currently one of 'user' or 'admin' (default is 'user')
* - func: The name of the module function to execute (default is 'main')
* - assign: The name of a variable to which the results are assigned
* - all remaining parameters are passed to the module API function
*
* Examples
* {modapifunc modname='News' type='user' func='get' sid='3'}
*
* {modapifunc modname='foobar' type='user' func='getfoo' id='1' assign='myfoo'}
* {$myfoo.title}
*
* @param array $params All attributes passed to this function from the template.
* @param Zikula_View $view Reference to the Zikula_View object.
*
* @see function.modfunc.php::smarty_function_modfunc()
*
* @return string The results of the module API function.
*/
function smarty_function_modapifunc($params, Zikula_View $view)
{
$assign = isset($params['assign']) ? $params['assign'] : null;
$func = isset($params['func']) && $params['func'] ? $params['func'] : 'main';
$modname = isset($params['modname']) ? $params['modname'] : null;
$type = isset($params['type']) && $params['type'] ? $params['type'] : 'user';
// avoid passing these to ModUtil::apiFunc
unset($params['modname']);
unset($params['type']);
unset($params['func']);
unset($params['assign']);
if (!$modname) {
$view->trigger_error(__f('Error! in %1$s: the %2$s parameter must be specified.', array('modapifunc', 'modname')));
return false;
}
if (isset($params['modnamefunc'])) {
$params['modname'] = $params['modnamefunc'];
unset($params['modnamefunc']);
}
$result = ModUtil::apiFunc($modname, $type, $func, $params);
if ($assign) {
$view->assign($assign, $result);
} else {
return $result;
}
}
示例7: display
/**
* Display the block.
*
* @param array $blockinfo A blockinfo structure.
*
* @return string The rendered block.
*/
public function display($blockinfo)
{
// Check if the Profile module is available or saving of login dates are disabled
if (!ModUtil::available('Profile')) {
return false;
}
// Security check
if (!SecurityUtil::checkPermission('Profile:LastSeenblock:', "$blockinfo[title]::", ACCESS_READ)) {
return false;
}
// Get variables from content block
$vars = BlockUtil::varsFromContent($blockinfo['content']);
$this->view->setCaching(false);
// get last x logged in user id's
$users = ModUtil::apiFunc('Profile', 'memberslist', 'getall', array(
'sortby' => 'lastlogin',
'numitems' => $vars['amount'],
'sortorder' => 'DESC',
));
$this->view->assign('users', $users);
$blockinfo['content'] = $this->view->fetch('profile_block_lastseen.tpl');
return BlockUtil::themeBlock($blockinfo);
}
示例8: coreinit
/**
* Event listener for 'core.postinit' event.
*
* @param Zikula_Event $event
*
* @return void
*/
public static function coreinit(Zikula_Event $event)
{
// get the module name
$args = array();
$args['modulename'] = ModUtil::getName();
$module = $args['modulename'];
// exit if Content module active - to avoid double loadings if user has given ids and functions
if ($args['modulename'] == 'content') {
return;
}
// Security check if user has COMMENT permission for scribite
if (!SecurityUtil::checkPermission('Scribite::', "{$module}::", ACCESS_COMMENT)) {
return;
}
// get passed func
$func = FormUtil::getPassedValue('func', isset($args['func']) ? $args['func'] : null, 'GET');
// get config for current module
$modconfig = array();
$modconfig = ModUtil::apiFunc('Scribite', 'user', 'getModuleConfig', array('modulename' => $args['modulename']));
// return if module is not supported or editor is not set
if (!$modconfig['mid'] || $modconfig['modeditor'] == '-') {
return;
}
// check if current func is fine for editors or funcs is empty (or all funcs)
if (is_array($modconfig['modfuncs']) && (in_array($func, $modconfig['modfuncs']) || $modconfig['modfuncs'][0] == 'all')) {
$args['areas'] = $modconfig['modareas'];
$args['editor'] = $modconfig['modeditor'];
$scribite = ModUtil::apiFunc('Scribite', 'user', 'loader', array('modulename' => $args['modulename'], 'editor' => $args['editor'], 'areas' => $args['areas']));
// add the scripts to page header
if ($scribite) {
PageUtil::AddVar('header', $scribite);
}
}
}
示例9: moduleSearch
/**
*
*/
public function moduleSearch($args)
{
$dom = ZLanguage::getModuleDomain('MUBoard');
$searchsubmit = $this->request->getPost()->filter('searchsubmit', 'none', FILTER_SANITIZE_STRING);
$searchoptions = $this->request->getPost()->filter('searchoptions', 'all', FILTER_SANITIZE_STRING);
$searchplace = $this->request->getPost()->filter('searchplace', 'title', FILTER_SANITIZE_STRING);
$resultorder = $this->request->getPost()->filter('resultorder', 'none', FILTER_SANITIZE_STRING);
$kind = $this->request->query->filter('kind', 'none', FILTER_SANITIZE_STRING);
// user has not entered a string and there is 'none' as kind of search
if ($searchsubmit == 'none' && $kind == 'none') {
// return search form template
return $this->searchRedirect();
} else {
if ($searchsubmit != 'none' && $kind == 'none') {
$searchstring = $this->request->getPost()->filter('searchstring', '', FILTER_SANITIZE_STRING);
if ($searchstring == '') {
$url = ModUtil::url($this->name, 'search', 'modulesearch');
return LogUtil::registerError(__('You have to enter a string!', $dom), null, $url);
} else {
$args['searchstring'] = $searchstring;
$args['searchoptions'] = $searchoptions;
$args['searchplace'] = $searchplace;
$args['resultorder'] = $resultorder;
$args['kind'] = $kind;
}
}
if ($searchsubmit == 'none' && $kind != 'none') {
$args['kind'] = $kind;
}
}
return ModUtil::apiFunc($this->name, 'search', 'moduleSearch', $args);
}
示例10: display
function display()
{
$prevpage = null;
$nextpage = null;
$page = ModUtil::apiFunc('Content', 'Page', 'getPage', array('id' => $this->pageId));
$tables = DBUtil::getTables();
$pageTable = $tables['content_page'];
$pageColumn = $tables['content_page_column'];
$options = array('makeTree' => true);
$options['orderBy'] = 'position';
$options['orderDir'] = 'desc';
$options['pageSize'] = 1;
$options['filter']['superParentId'] = $page['parentPageId'];
if ($page['position'] > 0) {
$options['filter']['where'] = "{$pageColumn['level']} = {$page['level']} and {$pageColumn['position']} < {$page['position']}";
$pages = ModUtil::apiFunc('Content', 'Page', 'getPages', $options);
if (count($pages) > 0) {
$prevpage = $pages[0];
}
}
if (isset($page['position']) && $page['position'] >= 0) {
$options['orderDir'] = 'asc';
$options['filter']['where'] = "{$pageColumn['level']} = {$page['level']} and {$pageColumn['position']} > {$page['position']}";
$pages = ModUtil::apiFunc('Content', 'Page', 'getPages', $options);
if (count($pages) > 0) {
$nextpage = $pages[0];
}
}
$this->view->assign('loggedin', UserUtil::isLoggedIn());
$this->view->assign('prevpage', $prevpage);
$this->view->assign('nextpage', $nextpage);
return $this->view->fetch($this->getTemplate());
}
示例11: display
/**
* Display block.
*
* @param array $blockInfo A blockinfo structure.
*
* @return string The rendered block.
*/
public function display($blockInfo)
{
$renderedOutput = '';
if (SecurityUtil::checkPermission('Accountlinks::', $blockInfo['title']."::", ACCESS_READ)) {
// Get variables from content block
$vars = BlockUtil::varsFromContent($blockInfo['content']);
// Call the modules API to get the items
if (ModUtil::available($this->name)) {
$accountlinks = ModUtil::apiFunc($this->name, 'user', 'accountLinks');
// Check for no items returned
if (!empty($accountlinks)) {
$this->view->setCaching(Zikula_View::CACHE_DISABLED)
->assign('accountlinks', $accountlinks);
// Populate block info and pass to theme
$blockInfo['content'] = $this->view->fetch('users_block_accountlinks.tpl');
$renderedOutput = BlockUtil::themeBlock($blockInfo);
}
}
}
return $renderedOutput;
}
示例12: getlinks
public function getlinks($args)
{
$links = array();
$sublinks = array();
$links[] = array('url' => ModUtil::url('Scribite', 'admin', 'modules'), 'text' => $this->__('Module list'), 'class' => 'z-icon-es-view');
$links[] = array('url' => ModUtil::url('Scribite', 'admin', 'newmodule'), 'text' => $this->__('Add module'), 'class' => 'z-icon-es-new');
$links[] = array('url' => ModUtil::url('Scribite', 'admin', 'modifyconfig'), 'text' => $this->__('Settings'), 'class' => 'z-icon-es-config');
// check for all supported editors and generate links
if (ModUtil::apiFunc('scribite', 'user', 'getEditors', array('editorname' => 'xinha'))) {
$sublinks[] = array('url' => ModUtil::url('scribite', 'admin', 'modifyxinha'), 'text' => $this->__('Xinha'));
}
if (ModUtil::apiFunc('scribite', 'user', 'getEditors', array('editorname' => 'ckeditor'))) {
$sublinks[] = array('url' => ModUtil::url('scribite', 'admin', 'modifyckeditor'), 'text' => $this->__('CKEditor'));
}
// openwysiwyg deprecated @4.3.0
// if (ModUtil::apiFunc('scribite', 'user', 'getEditors', array('editorname' => 'openwysiwyg'))) {
// $sublinks[] = array(
// 'url' => ModUtil::url('scribite', 'admin', 'modifyopenwysiwyg'),
// 'text' => $this->__('openWYSIWYG'));
// }
if (ModUtil::apiFunc('scribite', 'user', 'getEditors', array('editorname' => 'nicedit'))) {
$sublinks[] = array('url' => ModUtil::url('scribite', 'admin', 'modifynicedit'), 'text' => $this->__('NicEdit'));
}
if (ModUtil::apiFunc('scribite', 'user', 'getEditors', array('editorname' => 'markitup'))) {
$sublinks[] = array('url' => ModUtil::url('scribite', 'admin', 'modifymarkitup'), 'text' => $this->__('markitup'));
}
if (ModUtil::apiFunc('scribite', 'user', 'getEditors', array('editorname' => 'tinymce'))) {
$sublinks[] = array('url' => ModUtil::url('scribite', 'admin', 'modifytinymce'), 'text' => $this->__('TinyMCE'));
}
// add YUI page
$sublinks[] = array('url' => ModUtil::url('scribite', 'admin', 'modifyyui'), 'text' => $this->__('YUI Editor'));
$links[] = array('url' => ModUtil::url('Scribite', 'admin', 'modules'), 'text' => $this->__('Editor Config'), 'class' => 'z-icon-es-editor', 'links' => $sublinks);
// return output
return $links;
}
示例13: getContent
public function getContent($args)
{
switch ($args['pluginid']) {
case 1:
//$uid = $args['uid'];
// Get matching news stories published since last newsletter
// No selection on categories made !!
$items = ModUtil::apiFunc('News', 'user', 'getall',
array('numitems' => $this->getVar('itemsperpage'),
'status' => 0,
'from' => DateUtil::getDatetime($args['last']),
'filterbydate' => true));
if ($items != false) {
if ($args['contenttype'] == 't') {
$counter = 0;
$output.="\n";
foreach ($items as $item) {
$counter++;
$output .= $counter . '. ' . $item['title'] . " (" . $this->__f('by %1$s on %2$s', array($item['contributor'], DateUtil::formatDatetime($item['from'], 'datebrief'))) . ")\n";
}
} else {
$render = Zikula_View::getInstance('News');
$render->assign('readperm', SecurityUtil::checkPermission('News::', "::", ACCESS_READ));
$render->assign('articles', $items);
$output = $render->fetch('mailz/listarticles.tpl');
}
} else {
$output = $this->__f('No News publisher articles since last newsletter on %s.', DateUtil::formatDatetime($args['last'], 'datebrief')) . "\n";
}
return $output;
}
return '';
}
示例14: handleCommand
public function handleCommand(Zikula_Form_View $view, &$args)
{
if (!SecurityUtil::checkPermission('Content:page:', '::', ACCESS_ADD)) {
throw new Zikula_Exception_Forbidden($this->__('Error! You have not been granted access to create pages.'));
}
if ($args['commandName'] == 'create') {
$pageData = $this->view->getValues();
$validators = $this->notifyHooks(new Zikula_ValidationHook('content.ui_hooks.pages.validate_edit', new Zikula_Hook_ValidationProviders()))->getValidators();
if (!$validators->hasErrors() && $this->view->isValid()) {
$id = ModUtil::apiFunc('Content', 'Page', 'newPage', array('page' => $pageData, 'pageId' => $this->pageId, 'location' => $this->location));
if ($id === false) {
return false;
}
// notify any hooks they may now commit the as the original form has been committed.
$objectUrl = new Zikula_ModUrl('Content', 'user', 'view', ZLanguage::getLanguageCode(), array('pid' => $this->pageId));
$this->notifyHooks(new Zikula_ProcessHook('content.ui_hooks.pages.process_edit', $this->pageId, $objectUrl));
} else {
return false;
}
$url = ModUtil::url('Content', 'admin', 'editPage', array('pid' => $id));
} else {
if ($args['commandName'] == 'cancel') {
$id = null;
$url = ModUtil::url('Content', 'admin', 'main');
}
}
return $this->view->redirect($url);
}
示例15: search
public function search(){
// Check permission
$this->throwForbiddenUnless(SecurityUtil::checkPermission('Llicencies::', '::', ACCESS_READ));
//path to zk jquery lib
$js = new JCSSUtil;
$scripts = $js->scriptsMap();
$jquery = $scripts['jquery']['path'];
// Omplim les llistes desplegables del fromulari
$cursos = ModUtil::apiFunc('Llicencies', 'user', 'getYears');
$temes = ModUtil::apiFunc('Llicencies', 'user', 'getTopicList');
$subtemes = ModUtil::apiFunc('Llicencies', 'user', 'getSubtopicList');
$tipus = ModUtil::apiFunc('Llicencies', 'user', 'getTypeList');
$view = Zikula_View::getInstance($this->name);
$view->assign('jquery' , $jquery);
$view->assign('cursos' , $cursos);
$view->assign('temes' , $temes);
$view->assign('subtemes', $subtemes);
$view->assign('tipus' , $tipus);
$view->assign('admin' , false);
// Carreagr el formulari per a fer la cerca de llicències d'estudi
return $this->view->display('Llicencies_main.tpl');
}