当前位置: 首页>>代码示例>>PHP>>正文


PHP current_object函数代码示例

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


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

示例1: module_mustread

/**
 * @param $mod_reference
 * @param $module_params
 */
function module_mustread($mod_reference, $module_params)
{
    global $prefs;
    $smarty = TikiLib::lib('smarty');
    $object = current_object();
    $smarty->assign('mustread_module', ['object' => $object, 'field' => $module_params['objectField']]);
}
开发者ID:rjsmelo,项目名称:tiki,代码行数:11,代码来源:mod-func-mustread.php

示例2: module_category_transition

/**
 * @param $mod_reference
 * @param $module_params
 */
function module_category_transition($mod_reference, $module_params)
{
    $smarty = TikiLib::lib('smarty');
    $modlib = TikiLib::lib('mod');
    if ($object = current_object()) {
        $cat_type = $object['type'];
        $cat_objid = $object['object'];
        $smarty->assign('objType', $cat_type);
        $smarty->assign('objId', $cat_objid);
        require_once 'lib/transitionlib.php';
        $transitionlib = new TransitionLib('category');
        if (isset($_POST['transition'])) {
            $transitionlib->triggerTransition($_POST['transition'], $cat_objid, $cat_type);
            header('Location: ' . $_SERVER['REQUEST_URI']);
            exit;
        }
        $transitions = $transitionlib->getAvailableTransitions($cat_objid, $cat_type);
        $smarty->assign('mod_transitions', $transitions);
    } else {
        if ($modlib->is_admin_mode(true)) {
            // add a dummy transition to display on the module admin page
            $smarty->assign('mod_transitions', array(array('enabled' => true, 'transitionId' => 0, 'name' => tra('Example Transition'))));
        }
    }
}
开发者ID:linuxwhy,项目名称:tiki-1,代码行数:29,代码来源:mod-func-category_transition.php

示例3: module_contributors

function module_contributors($mod_reference, $module_params)
{
	global $smarty, $userlib, $wikilib, $tikilib, $headerlib;
	$currentObject = current_object();
	if ($currentObject['type'] == 'wiki page') {
		$objectperms = Perms::get(array('type' => 'wiki page', 'object' => $currentObject['object']));
		if ($objectperms->view) {
			$contributors = $wikilib->get_contributors($currentObject['object']);
			$contributors_details = array();
			$headerlib->add_css('div.contributors div br {clear: both;}'); // Avoid avatar conflicts with lines below
			foreach ($contributors as $contributor) {
				$details = array('login' => $contributor);
				$details['realName'] = $userlib->get_user_preference($contributor, 'realName');
				$country = $tikilib->get_user_preference($contributor, 'country');
				if (!is_null($country) && $country != 'Other') {
					$details['country'] = $country;
				}
				$email_isPublic = $tikilib->get_user_preference($contributor, 'email is public');
				if ($email_isPublic != 'n') {
					include_once ('lib/userprefs/scrambleEmail.php');
					$details['email'] = $userlib->get_user_email($contributor);
					$details['scrambledEmail'] = scrambleEmail($details['email'], $email_isPublic);
				}
				$details['homePage'] = $tikilib->get_user_preference($contributor, 'homePage');
				$details['avatar'] = $tikilib->get_user_avatar($contributor);
				$contributors_details[] = $details;
			}
			$smarty->assign_by_ref('contributors_details', $contributors_details);
			$hiddenContributors = count($contributors_details) - 5;
			if ($hiddenContributors > 0) {
				$smarty->assign('hiddenContributors', $hiddenContributors);
			}
		}		
	}
}
开发者ID:railfuture,项目名称:tiki-website,代码行数:35,代码来源:mod-func-contributors.php

示例4: wikiplugin_relations

function wikiplugin_relations($data, $params)
{
    $object = current_object();
    if (isset($params['object']) && false !== strpos($params['object'], ':')) {
        list($object['type'], $object['object']) = explode(':', $params['object'], 2);
    }
    if (!isset($params['qualifiers'])) {
        return WikiParser_PluginOutput::argumentError(array('qualifiers'));
    }
    $singlelist = false;
    if (isset($params['singlelist']) && $params['singlelist']) {
        $singlelist = true;
    }
    $emptymsg = "No relations found.";
    if (isset($params['emptymsg']) && $params['emptymsg']) {
        $emptymsg = $params['emptymsg'];
    }
    $data = array();
    $relationlib = TikiLib::lib('relation');
    foreach ($params['qualifiers'] as $qualifier) {
        $name = $singlelist ? 'singlelist' : tra($qualifier);
        $found = $relationlib->get_relations_from($object['type'], $object['object'], $qualifier);
        foreach ($found as $relation) {
            $type = $relation['type'];
            $id = $relation['itemId'];
            $data[$name]["{$type}:{$id}"] = array('type' => $type, 'object' => $id);
        }
    }
    $smarty = TikiLib::lib('smarty');
    $smarty->assign('wp_relations', $data);
    $smarty->assign('wp_singlelist', $singlelist);
    $smarty->assign('wp_emptymsg', $emptymsg);
    return $smarty->fetch('wiki-plugins/wikiplugin_relations.tpl');
}
开发者ID:linuxwhy,项目名称:tiki-1,代码行数:34,代码来源:wikiplugin_relations.php

示例5: module_articles

/**
 * @param $mod_reference
 * @param $module_params
 */
function module_articles($mod_reference, $module_params)
{
    global $user;
    $tikilib = TikiLib::lib('tiki');
    $smarty = TikiLib::lib('smarty');
    $artlib = TikiLib::lib('art');
    $urlParams = array('topicId' => 'topic', 'topic' => 'topicName', 'categId' => 'categId', 'type' => 'type', 'langfilter' => 'lang', 'start' => null, 'sort' => null);
    if (isset($module_params['topicId']) && $module_params['topicId'] == 0 && ($object = current_object()) && $object['type'] == 'article') {
        $topicId = $smarty->getTemplateVars('topicId');
    }
    foreach ($urlParams as $p => $v) {
        if (isset(${$p})) {
            continue;
        }
        ${$p} = isset($module_params[$p]) ? $module_params[$p] : '';
    }
    if ($start == '') {
        $start = 0;
    }
    if ($sort == '') {
        $sort = 'publishDate_desc';
    }
    $min_rating = isset($_REQUEST['min_rating']) ? $_REQUEST['min_rating'] : 0;
    $max_rating = isset($_REQUEST['max_rating']) ? $_REQUEST['max_rating'] : 10;
    $smarty->assign('min_rating', $min_rating);
    $smarty->assign('max_rating', $max_rating);
    $ranking = $artlib->list_articles($start, $mod_reference['rows'], $sort, '', '', '', $user, $type, $topicId, 'y', $topic, $categId, '', '', $langfilter, $min_rating, $max_rating, '', 'y');
    $smarty->assign_by_ref('urlParams', $urlParams);
    $smarty->assign('modArticles', $ranking["data"]);
    $smarty->assign('more', isset($module_params['more']) ? $module_params['more'] : 'n');
    $smarty->assign('absurl', isset($module_params["absurl"]) ? $module_params["absurl"] : 'n');
    $smarty->assign('showcreated', isset($module_params['showcreated']) ? $module_params['showcreated'] : 'n');
    $smarty->assign('showpubl', isset($module_params['showpubl']) ? $module_params['showpubl'] : 'n');
    $smarty->assign('show_rating_selector', isset($module_params['show_rating_selector']) ? $module_params['show_rating_selector'] : 'n');
}
开发者ID:linuxwhy,项目名称:tiki-1,代码行数:39,代码来源:mod-func-articles.php

示例6: smarty_block_title

function smarty_block_title($params, $content, $template, &$repeat)
{
    global $prefs, $tiki_p_view_templates, $tiki_p_edit_templates, $tiki_p_admin;
    if ($repeat || empty($content)) {
        return;
    }
    $template->loadPlugin('smarty_function_icon');
    $template->loadPlugin('smarty_modifier_sefurl');
    $template->loadPlugin('smarty_modifier_escape');
    if (!isset($params['help'])) {
        $params['help'] = '';
    }
    if (!isset($params['admpage'])) {
        $params['admpage'] = '';
    }
    if (!isset($params['actions'])) {
        $params['actions'] = '';
    }
    // Set the variable for the HTML title tag
    $template->smarty->assign('headtitle', $content);
    $class = '';
    $current = current_object();
    if (!isset($params['url'])) {
        $params['url'] = smarty_modifier_sefurl($current['object'], $current['type']);
    }
    $metadata = '';
    $coordinates = TikiLib::lib('geo')->get_coordinates($current['type'], $current['object']);
    if ($coordinates) {
        $class = ' geolocated primary';
        $metadata = " data-geo-lat=\"{$coordinates['lat']}\" data-geo-lon=\"{$coordinates['lon']}\"";
        if (isset($coordinates['zoom'])) {
            $metadata .= " data-geo-zoom=\"{$coordinates['zoom']}\"";
        }
    }
    $html = '<h1 class="pagetitle">';
    $html .= '<a class="' . $class . '"' . $metadata . ' href="' . $params['url'] . '">' . smarty_modifier_escape($content) . "</a>\n";
    if ($template->getTemplateVars('print_page') != 'y') {
        if ($prefs['feature_help'] == 'y' && $prefs['helpurl'] != '' && $params['help'] != '') {
            $html .= '<a href="';
            $html .= $prefs['helpurl'] . rawurlencode($params['help']) . '" class="tips btn btn-link" title="' . smarty_modifier_escape($content) . '|' . tra('Help page') . '" target="tikihelp">' . smarty_function_icon(array('name' => 'help'), $template) . "</a>\n";
        }
        if ($prefs['feature_edit_templates'] == 'y' && $tiki_p_edit_templates == 'y' && ($tpl = $template->getTemplateVars('mid'))) {
            $html .= '<a href="tiki-edit_templates.php?template=';
            $html .= $tpl . '" class="tips btn btn-link" title="' . tra('View or edit tpl') . '|' . htmlspecialchars($content) . '">' . smarty_function_icon(array('name' => 'edit'), $template) . "</a>\n";
        } elseif ($prefs['feature_view_tpl'] == 'y' && $tiki_p_view_templates == 'y' && ($tpl = $template->getTemplateVars('mid'))) {
            $html .= '<a href="tiki-edit_templates.php?template=';
            $html .= $tpl . '" class="tips btn btn-link" title="' . tra('View tpl') . '|' . htmlspecialchars($content) . '">' . smarty_function_icon(array('name' => 'view'), $template) . "</a>\n";
        }
        if ($tiki_p_admin == 'y' && $params['admpage'] != '') {
            $html .= '<a class="tips btn btn-link" href="tiki-admin.php?page=';
            $html .= $params['admpage'] . '" title="' . htmlspecialchars($content) . '|' . tra('Settings') . '">' . smarty_function_icon(array('name' => 'settings'), $template) . "</a>\n";
        }
        if ($params['actions'] != '') {
            $html .= $params['actions'];
        }
    }
    $html .= '</h1>';
    return $html;
}
开发者ID:rjsmelo,项目名称:tiki,代码行数:59,代码来源:block.title.php

示例7: wikiplugin_addfreetag

function wikiplugin_addfreetag($data, $params)
{
	global $user;
	$object = current_object();

	if (isset($params['object']) && false !== strpos($params['object'], ':')) {
		list($object['type'], $object['object']) = explode(':', $params['object'], 2);
	}
	if ($object['type'] == 'wiki page' && !ctype_digit($object['object'])) {
		$identifier = 'wp_addfreetag_' . str_replace(array(':',' '), array('_',''), TikiLib::lib('tiki')->get_page_id_from_name($params['object']));
	} else {
		$identifier = 'wp_addfreetag_' . str_replace(array(':',' '), array('_',''), $params['object']);
	}

	if ($object['type'] == 'trackeritem') {
		$permobject = TikiLib::lib('trk')->get_tracker_for_item($object['object']);
		$permobjecttype = 'tracker';
	} else {
		$permobject = $object['object'];
		$permobjecttype = $object['type'];
	}
	if (! TikiLib::lib('tiki')->user_has_perm_on_object($user, $permobject, $permobjecttype, 'tiki_p_freetags_tag')) {
		return '';
	}
	if (!empty($_POST[$identifier])) {
		$_POST[$identifier] = '"' . str_replace('"', '', $_POST[$identifier]) . '"';
		TikiLib::lib('freetag')->tag_object($user, $object['object'], $object['type'], $_POST[$identifier]);
		if ($object['type'] == 'trackeritem') {
			// need to update tracker field as well
			$definition = Tracker_Definition::get($permobject);
			if ($field = $definition->getFreetagField()) {
				$currenttags = TikiLib::lib('freetag')->get_tags_on_object($object['object'], 'trackeritem');
				$taglist = '';	
				foreach ($currenttags['data'] as $tag) {
					if (strstr($tag['tag'], ' ')) {
						$taglist .= '"'.$tag['tag'] . '" ';
					} else {
						$taglist .= $tag['tag'] . ' ';
					}
				}
				// taglist will have slashes
				TikiLib::lib('trk')->modify_field($object['object'], $field, stripslashes($taglist));
			}
		} 
		require_once 'lib/search/refresh-functions.php';
		refresh_index($object['type'], $object['object']);
		$url = $_SERVER['REQUEST_URI'];
		header("Location: $url");
		die;
	}

	$smarty = TikiLib::lib('smarty');
	$smarty->assign('wp_addfreetag', $identifier); 
	return $smarty->fetch('wiki-plugins/wikiplugin_addfreetag.tpl');
}
开发者ID:railfuture,项目名称:tiki-website,代码行数:55,代码来源:wikiplugin_addfreetag.php

示例8: module_search_morelikethis

/**
 * @param $mod_reference
 * @param $module_params
 */
function module_search_morelikethis($mod_reference, $module_params)
{
    global $prefs;
    $smarty = TikiLib::lib('smarty');
    $textfilters = array();
    $typefilters = array();
    if (!empty($module_params['textfilters'])) {
        $filters = explode(",", $module_params['textfilters']);
        $filters = array_map('trim', $filters);
        foreach ($filters as $f) {
            $exploded = explode("=", $f);
            if (!empty($exploded[1]) && !empty($exploded[0])) {
                $textfilters[$exploded[0]] = $exploded[1];
            }
        }
    }
    if (!empty($module_params['typefilters'])) {
        $typefilters = explode(",", $module_params['typefilters']);
        $typefilters = array_map('trim', $typefilters);
    }
    $object = array();
    if ($module_params['object'] && $module_params['type']) {
        $object['object'] = $module_params['object'];
        $object['type'] = $module_params['type'];
    } else {
        $object = current_object();
    }
    if (!empty($object)) {
        $unifiedsearchlib = TikiLib::lib('unifiedsearch');
        $query = $unifiedsearchlib->buildQuery(array());
        $query->filterSimilar($object['type'], $object['object']);
        $smarty->assign('simobject', $object);
        $query->setRange(0, $mod_reference['rows']);
        foreach ($textfilters as $k => $v) {
            $query->filterContent($v, $k);
        }
        if (!empty($typefilters)) {
            $query->filterType($typefilters);
        }
        if ($prefs['federated_enabled'] == 'y') {
            $fed = TikiLib::lib('federatedsearch');
            $fed->augmentSimilarQuery($query, $object['type'], $object['object']);
        }
        try {
            $morelikethis = $query->search($unifiedsearchlib->getIndex());
            $smarty->assign('modMoreLikeThis', $morelikethis);
            $smarty->assign('module_rows', $mod_reference["rows"]);
        } catch (Search_Elastic_NotFoundException $e) {
            // Target document not found - excluded from index, ignore module
        }
    }
    $smarty->assign('tpl_module_title', tra("Similar pages"));
}
开发者ID:rjsmelo,项目名称:tiki,代码行数:57,代码来源:mod-func-search_morelikethis.php

示例9: wikiplugin_addreference

function wikiplugin_addreference($data, $params)
{
    global $prefs;
    if ($prefs['wikiplugin_addreference'] == 'y') {
        $referenceslib = TikiLib::lib('references');
        if (!isset($GLOBALS['referencesData'])) {
            $GLOBALS['referencesData'] = array();
        }
        $data = trim($data);
        if (strstr($_SERVER['SCRIPT_NAME'], 'tiki-print.php')) {
            $page = urldecode($_REQUEST['page']);
            $page_id = TikiLib::lib('tiki')->get_page_id_from_name($page);
            $page_info = TikiLib::lib('tiki')->get_page_info($page);
        } else {
            $object = current_object();
            $page_id = TikiLib::lib('tiki')->get_page_id_from_name($object['object']);
            $page_info = TikiLib::lib('tiki')->get_page_info($object['object']);
        }
        extract($params, EXTR_SKIP);
        if (empty($params['biblio_code'])) {
            return;
        }
        $regex = "/{ADDREFERENCE\\(?\\ ?biblio_code=\"(.*)\"\\)?}.*({ADDREFERENCE})?/siU";
        preg_match_all($regex, $page_info['data'], $matches);
        $temp = array();
        $curr_matches = array();
        $temp = array_unique($matches[1]);
        $i = 0;
        foreach ($temp as $k => $v) {
            if (strlen(trim($v)) > 0) {
                $curr_matches[$i] = $v;
                $i++;
            }
        }
        unset($temp);
        $found_keys = array();
        foreach ($curr_matches as $key => $val) {
            if (strlen(trim($val)) > 0) {
                if ($val == $params['biblio_code']) {
                    if (!in_array($val, $found_keys)) {
                        $found_keys[] = $val;
                        $index = $key + 1;
                        $i++;
                    }
                }
            }
        }
        $GLOBALS['referencesData'] = $curr_matches;
        $url = $GLOBALS['base_uri'] . "#" . $params['biblio_code'];
        return $data . "<a href='" . $url . "' title='" . $params['biblio_code'] . "'><sup>" . $index . "</sup></a>";
    }
}
开发者ID:linuxwhy,项目名称:tiki-1,代码行数:52,代码来源:wikiplugin_addreference.php

示例10: smarty_block_title

function smarty_block_title($params, $content, $template, &$repeat)
{
    global $prefs, $tiki_p_view_templates, $tiki_p_edit_templates, $tiki_p_admin;
    if ($repeat || empty($content)) {
        return;
    }
    $template->loadPlugin('smarty_function_icon');
    if (!isset($params['help'])) {
        $params['help'] = '';
    }
    if (!isset($params['admpage'])) {
        $params['admpage'] = '';
    }
    if (!isset($params['url'])) {
        $template->loadPlugin('smarty_function_query');
        $params['url'] = htmlspecialchars(smarty_function_query(array('_type' => 'absolute_path'), $template));
        $params['url'] = str_replace('&amp;amp;', '&', $params['url']);
    }
    // Set the variable for the HTML title tag
    $template->smarty->assign('headtitle', $content);
    $class = 'pagetitle';
    $current = current_object();
    $metadata = '';
    $coordinates = TikiLib::lib('geo')->get_coordinates($current['type'], $current['object']);
    if ($coordinates) {
        $class = ' geolocated primary';
        $metadata = " data-geo-lat=\"{$coordinates['lat']}\" data-geo-lon=\"{$coordinates['lon']}\"";
        if (isset($coordinates['zoom'])) {
            $metadata .= " data-geo-zoom=\"{$coordinates['zoom']}\"";
        }
    }
    $html = '<h1>';
    $html .= '<a class="' . $class . '"' . $metadata . ' href="' . $params['url'] . '">' . htmlspecialchars($content) . "</a>\n";
    if ($template->getTemplateVars('print_page') != 'y') {
        if ($prefs['feature_help'] == 'y' && $prefs['helpurl'] != '' && $params['help'] != '') {
            $html .= '<a href="' . $prefs['helpurl'] . rawurlencode($params['help']) . '" class="titletips" title="' . tra('Help page:') . ' ' . htmlspecialchars($content) . '" target="tikihelp">' . smarty_function_icon(array('_id' => 'help'), $template) . "</a>\n";
        }
        if ($prefs['feature_edit_templates'] == 'y' && $tiki_p_edit_templates == 'y' && ($tpl = $template->getTemplateVars('mid'))) {
            $html .= '<a href="tiki-edit_templates.php?template=' . $tpl . '" class="titletips" title="' . tra('View or edit tpl:') . ' ' . htmlspecialchars($content) . '">' . smarty_function_icon(array('_id' => 'shape_square_edit', 'alt' => tra('Edit Template')), $template) . "</a>\n";
        } elseif ($prefs['feature_view_tpl'] == 'y' && $tiki_p_view_templates == 'y' && ($tpl = $template->getTemplateVars('mid'))) {
            $html .= '<a href="tiki-edit_templates.php?template=' . $tpl . '" class="titletips" title="' . tra('View tpl:') . ' ' . htmlspecialchars($content) . '">' . smarty_function_icon(array('_id' => 'shape_square', 'alt' => tra('View Template')), $template) . "</a>\n";
        }
        if ($tiki_p_admin == 'y' && $params['admpage'] != '') {
            $html .= '<a class="titletips" href="tiki-admin.php?page=' . $params['admpage'] . '" title="' . tra('Admin page:') . ' ' . htmlspecialchars($content) . '">' . smarty_function_icon(array('_id' => 'wrench', 'alt' => tra('Admin Feature')), $template) . "</a>\n";
        }
    }
    $html .= '</h1>';
    return $html;
}
开发者ID:railfuture,项目名称:tiki-website,代码行数:49,代码来源:block.title.php

示例11: module_freetags_morelikethis

/**
 * @param $mod_reference
 * @param $module_params
 */
function module_freetags_morelikethis($mod_reference, $module_params)
{
    $smarty = TikiLib::lib('smarty');
    $freetaglib = TikiLib::lib('freetag');
    $out = null;
    if (isset($module_params['type'])) {
        $out = $module_params['type'];
    }
    if ($object = current_object()) {
        $morelikethis = $freetaglib->get_similar($object['type'], $object['object'], $mod_reference["rows"], $out);
        $smarty->assign('modMoreLikeThis', $morelikethis);
        $smarty->assign('module_rows', $mod_reference["rows"]);
    }
    $smarty->assign('tpl_module_title', tra("Similar pages"));
}
开发者ID:linuxwhy,项目名称:tiki-1,代码行数:19,代码来源:mod-func-freetags_morelikethis.php

示例12: module_freetags_morelikethis

/**
 * @param $mod_reference
 * @param $module_params
 */
function module_freetags_morelikethis($mod_reference, $module_params)
{
    global $smarty;
    global $freetaglib;
    include_once 'lib/freetag/freetaglib.php';
    $out = null;
    if (isset($module_params['type'])) {
        $out = $module_params['type'];
    }
    if ($object = current_object()) {
        $morelikethis = $freetaglib->get_similar($object['type'], $object['object'], $mod_reference["rows"], $out);
        $smarty->assign('modMoreLikeThis', $morelikethis);
        $smarty->assign('module_rows', $mod_reference["rows"]);
    }
    $smarty->assign('tpl_module_title', tra("Similar pages"));
}
开发者ID:jkimdon,项目名称:cohomeals,代码行数:20,代码来源:mod-func-freetags_morelikethis.php

示例13: HandleObjectCategories

 function HandleObjectCategories($objectCategoryIds)
 {
     global $prefs;
     $perspectivelib = TikiLib::lib('perspective');
     $current_object = current_object();
     if (!$current_object) {
         // only used on tiki objects
         return;
     }
     $descendants = $this->get_category_descendants($prefs['areas_root']);
     $objectPerspective = 0;
     if (!empty($objectCategoryIds)) {
         if (!isset($_SESSION['current_perspective'])) {
             unset($_SESSION['current_perspective']);
         }
         foreach ($objectCategoryIds as $categId) {
             // If category is inside $prefs['areas_root']
             if (in_array($categId, $descendants)) {
                 $area = $this->getAreaByCategId($categId);
                 if ($area) {
                     $objectPerspective = $area['perspectives'][0];
                     // use 1st persp
                     break;
                 }
             }
         }
         if ($objectPerspective && $objectPerspective != $_SESSION['current_perspective']) {
             $area = $this->getAreaByPerspId($_SESSION['current_perspective']);
             $objectArea = $this->getAreaByPerspId($objectPerspective);
             if ($area && !$area['share_common'] || $objectArea && $objectArea['exclusive']) {
                 $perspectivelib->set_perspective($objectPerspective, true);
                 ZendOpenId\OpenId::redirect(ZendOpenId\OpenId::selfUrl());
             }
         }
     }
     if ($objectPerspective < 1 && !empty($_SESSION['current_perspective'])) {
         // uncategorised objects
         $area = $this->getAreaByPerspId($_SESSION['current_perspective']);
         if ($area) {
             if (!$area['share_common']) {
                 $perspectivelib->set_perspective($objectPerspective, true);
                 ZendOpenId\OpenId::redirect(ZendOpenId\OpenId::selfUrl());
             }
         }
     }
 }
开发者ID:linuxwhy,项目名称:tiki-1,代码行数:46,代码来源:binderlib.php

示例14: _breadcrumb_getTitle

function _breadcrumb_getTitle($crumbs, $loc)
{
    global $prefs, $print_page, $info, $structure, $structure_path, $tikilib, $smarty;
    $len = count($crumbs);
    if ($prefs['feature_breadcrumbs'] == 'n' || $prefs['feature_sitetitle'] == 'title') {
        $smarty->loadPlugin('smarty_modifier_sefurl');
        $smarty->loadPlugin('smarty_modifier_escape');
        $class = "pagetitle";
        $metadata = '';
        $current = current_object();
        $escapedHref = smarty_modifier_escape(smarty_modifier_sefurl($current['object'], $current['type']));
        if ($coordinates = TikiLib::lib('geo')->get_coordinates($current['type'], $current['object'])) {
            $class = ' geolocated primary';
            $metadata = " data-geo-lat=\"{$coordinates['lat']}\" data-geo-lon=\"{$coordinates['lon']}\"";
            if (isset($coordinates['zoom'])) {
                $metadata .= " data-geo-zoom=\"{$coordinates['zoom']}\"";
            }
        }
        $ret = '<strong><a class="' . $class . '"' . $metadata . ' title="' . tra("refresh") . '" href="' . $escapedHref . '">';
    } else {
        $class = "crumblink";
        $ret = '<a class="' . $class . '" title="';
        if ($structure == 'y' && $info) {
            $cnt = count($structure_path);
        } else {
            $cnt = count($crumbs);
        }
        $ret .= tra("go back to this crumb");
        $ret .= '" accesskey="' . $cnt;
        include_once 'tiki-sefurl.php';
        $ret .= '" href="' . filter_out_sefurl($crumbs[$len - 1]->url) . '">';
    }
    if ($prefs['feature_breadcrumbs'] == 'n' && $loc == "admin") {
        $ret .= tra("Administration:") . " ";
    }
    if (!empty($prefs['wiki_pagename_strip'])) {
        include_once 'lib/smarty_tiki/modifier.pagename.php';
        $ret .= tra(smarty_modifier_pagename($crumbs[$len - 1]->title)) . '</a>';
    } else {
        $ret .= htmlentities(tra($crumbs[$len - 1]->title), ENT_QUOTES, 'UTF-8') . '</a>';
    }
    $ret .= help_doclink(array('crumb' => $crumbs[$len - 1]));
    if (isset($info['flag']) && $info['flag'] == 'L' && $print_page != 'y') {
        $ret .= ' <img src="img/icons/lock.png" height="16" width="16" alt="' . tra('locked') . '" title="' . tra('locked by') . ' ' . $info['user'] . '" />';
    }
    if ($prefs['feature_breadcrumbs'] == 'n' || $prefs['feature_sitetitle'] == 'title') {
        $ret .= '</strong>';
    }
    return $ret;
}
开发者ID:railfuture,项目名称:tiki-website,代码行数:50,代码来源:breadcrumblib.php

示例15: wikiplugin_addrelation

function wikiplugin_addrelation($data, $params)
{
	if (isset($params['source_object']) && false !== strpos($params['source_object'], ':')) {
		list($source_object['type'], $source_object['object']) = explode(':', $params['source_object'], 2);
	} else {
		$source_object = current_object();
	}
	if (isset($params['target_object']) && false !== strpos($params['target_object'], ':')) {
		list($target_object['type'], $target_object['object']) = explode(':', $params['target_object'], 2);
	} else {
		$target_object = current_object(); 
	}
	if ($source_object == $target_object) {
		return tra('Source and target object cannot be the same');
	}
	if (!isset($params['qualifier'])) {
		return WikiParser_PluginOutput::argumentError(array('qualifier'));
	} else {
		$qualifier = $params['qualifier'];
	}
	if (!empty($params['label_add'])) {
		$labeladd = $params['label_add'];	
	} else {
		$labeladd = tra('Add Relation');
	}
	if (!empty($params['label_remove'])) {
		$labelremove = $params['label_remove'];
	} else {
		$labelremove = tra('Remove Relation');
	}
	if (!empty($params['label_added'])) {
		$labeladded = $params['label_added'];
	} else {
		$labeladded = tra('Relation Added');
	}
	if (!empty($params['button_id'])) {
		$id = 'wp_addrelation_' . $params['button_id'];
	} else {
		$id = 'wp_addrelation_0';
	}
	$relationlib = TikiLib::lib('relation');

	if (isset($_POST[$id])) {
		if ($_POST[$id] == 'y') {
			$relationlib->add_relation($qualifier, $source_object['type'], $source_object['object'], $target_object['type'], $target_object['object']);	
		} elseif ($_POST[$id] == 'n') {
			$relation_id = $relationlib->add_relation($qualifier, $source_object['type'], $source_object['object'], $target_object['type'], $target_object['object']);
			$relationlib->remove_relation($relation_id);
		}
		require_once 'lib/search/refresh-functions.php';
		refresh_index($source_object['type'], $source_object['object']);
		refresh_index($target_object['type'], $target_object['object']);
	}
	$relationsfromsource = $relationlib->get_relations_from($source_object['type'], $source_object['object'], $qualifier);
	$relationexists = false;
	foreach ($relationsfromsource as $r) {
		if ($r['itemId'] == $target_object['object'] && $r['type'] == $target_object['type']) {
			$relationexists = true;
			break;
		}
	}

	$smarty = TikiLib::lib('smarty');
	$smarty->assign('wp_addrelation_id', $id);
	$smarty->assign('wp_addrelation_action', $relationexists ? 'n' : 'y');
	$smarty->assign('label_add', $labeladd);
	$smarty->assign('label_added', $labeladded);
	$smarty->assign('label_remove', $labelremove);
	return $smarty->fetch('wiki-plugins/wikiplugin_addrelation.tpl');
}
开发者ID:railfuture,项目名称:tiki-website,代码行数:70,代码来源:wikiplugin_addrelation.php


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