本文整理汇总了PHP中get_object_type函数的典型用法代码示例。如果您正苦于以下问题:PHP get_object_type函数的具体用法?PHP get_object_type怎么用?PHP get_object_type使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_object_type函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
function __construct($range_id){
$this->range_id = $range_id;
$this->range_type = get_object_type($range_id);
$object_name = get_object_name($range_id, $this->range_type);
$this->range_name = $object_name['type'] . ": " . $object_name['name'];
$this->createGroups();
}
示例2: before_filter
/**
* common tasks for all actions
*/
function before_filter(&$action, &$args)
{
global $perm;
parent::before_filter($action, $args);
$course_id = $args[0];
$this->course_id = Request::option('cid', $course_id);
Navigation::activateItem('/course/admin/admission');
if (!get_object_type($this->course_id, array('sem')) || SeminarCategories::GetBySeminarId($this->course_id)->studygroup_mode || !$perm->have_studip_perm("tutor", $this->course_id)) {
throw new Trails_Exception(403);
}
$this->course = Course::find($this->course_id);
$this->user_id = $GLOBALS['user']->id;
PageLayout::setHelpKeyword("Basis.VeranstaltungenVerwaltenZugangsberechtigungen");
PageLayout::setTitle($this->course->getFullname() . " - " . _("Verwaltung von Zugangsberechtigungen"));
$lockrules = words('admission_turnout admission_type admission_endtime admission_binding passwort read_level write_level admission_prelim admission_prelim_txt admission_starttime admission_endtime_sem admission_disable_waitlist user_domain admission_binding admission_studiengang');
foreach ($lockrules as $rule) {
$this->is_locked[$rule] = LockRules::Check($this->course_id, $rule) ? 'disabled readonly' : '';
}
if (!SeminarCategories::GetByTypeId($this->course->status)->write_access_nobody) {
$this->is_locked['write_level'] = 'disabled readonly';
}
update_admission($this->course->id);
PageLayout::addSqueezePackage('admission');
URLHelper::addLinkParam('return_to_dialog', Request::get('return_to_dialog'));
}
示例3: before_filter
/**
* common tasks for all actions
*/
function before_filter(&$action, &$args)
{
global $perm;
parent::before_filter($action, $args);
if (Request::get('termin_id')) {
$this->dates[0] = new SingleDate(Request::option('termin_id'));
$this->course_id = $this->dates[0]->range_id;
}
if (Request::get('issue_id')) {
$this->issue_id = Request::option('issue_id');
$this->dates = array_values(array_map(function ($data) {
$d = new SingleDate();
$d->fillValuesFromArray($data);
return $d;
}, IssueDB::getDatesforIssue(Request::option('issue_id'))));
$this->course_id = $this->dates[0]->range_id;
}
if (!get_object_type($this->course_id, array('sem')) || SeminarCategories::GetBySeminarId($this->course_id)->studygroup_mode || !$perm->have_studip_perm("tutor", $this->course_id)) {
throw new Trails_Exception(400);
}
PageLayout::setHelpKeyword("Basis.VeranstaltungenVerwaltenAendernVonZeitenUndTerminen");
PageLayout::setTitle(Course::findCurrent()->getFullname() . " - " . _("Veranstaltungstermine absagen"));
$this->set_content_type('text/html;charset=windows-1252');
if (Request::isXhr()) {
$this->set_layout(null);
$this->response->add_header('X-Title', PageLayout::getTitle());
$request = Request::getInstance();
foreach ($request as $key => $value) {
$request[$key] = studip_utf8decode($value);
}
}
}
示例4: getTabNavigation
function getTabNavigation($course_id)
{
$object_type = get_object_type($course_id, array('sem', 'inst'));
if ($object_type === 'sem') {
$course = Course::find($course_id);
$sem_class = $GLOBALS['SEM_CLASS'][$GLOBALS['SEM_TYPE'][$course->status]['class']] ?: SemClass::getDefaultSemClass();
} else {
$institute = Institute::find($course_id);
$sem_class = SemClass::getDefaultInstituteClass($institute->type);
}
$navigation = new Navigation(_('Übersicht'));
$navigation->setImage(Icon::create('seminar', 'info_alt'));
$navigation->setActiveImage(Icon::create('seminar', 'info'));
if ($object_type !== 'sem') {
$navigation->addSubNavigation('info', new Navigation(_('Kurzinfo'), 'dispatch.php/institute/overview'));
$navigation->addSubNavigation('courses', new Navigation(_('Veranstaltungen'), 'show_bereich.php?level=s&id=' . $course_id));
$navigation->addSubNavigation('schedule', new Navigation(_('Veranstaltungs-Stundenplan'), 'dispatch.php/calendar/instschedule?cid=' . $course_id));
if ($GLOBALS['perm']->have_studip_perm('admin', $course_id)) {
$navigation->addSubNavigation('admin', new Navigation(_('Administration der Einrichtung'), 'dispatch.php/institute/basicdata/index?new_inst=TRUE'));
}
} else {
$navigation->addSubNavigation('info', new Navigation(_('Kurzinfo'), 'dispatch.php/course/overview'));
if (!$sem_class['studygroup_mode']) {
$navigation->addSubNavigation('details', new Navigation(_('Details'), 'dispatch.php/course/details/'));
}
if (!$course->admission_binding && in_array($GLOBALS['perm']->get_studip_perm($course_id), array('user', 'autor'))) {
$navigation->addSubNavigation('leave', new Navigation(_('Austragen aus der Veranstaltung'), 'dispatch.php/my_courses/decline/' . $course_id . '?cmd=suppose_to_kill'));
}
}
return array('main' => $navigation);
}
示例5: getRangename
/**
* Gets the name of the range. Copied somewhere from Stud.IP...
* @access public
* @param string $rangeID the rangeID
* @param boolean $html_decode (optional)
* @return string The name of the range
*/
function getRangename($rangeID, $html_decode = true)
{
global $user;
if ($rangeID == "studip") {
return _("Systemweite Evaluationen");
}
$o_type = get_object_type($rangeID, array('sem', 'user', 'inst'));
if (in_array($o_type, array('sem', 'inst', 'fak'))) {
$name = getHeaderLine($rangeID);
if ($name != NULL) {
if ($html_decode) {
$rangename = decodeHTML($name);
} else {
$rangename = $name;
}
} else {
$rangename = _("Kein Titel gefunden.");
}
return $rangename;
}
if ($o_type != 'user') {
$user_id = get_userid($rangeID);
} else {
$user_id = $rangeID;
}
if ($user_id != $user->id) {
$rangename = _("Profil: ") . get_fullname($user_id, 'full', 1) . " (" . get_username($user_id) . ")";
} else {
$rangename = _("Profil");
}
return $rangename;
}
示例6: setVisit
/**
* Set the seminar denoted by the passed id as visited by the currently
* logged in user
*
* @param string $seminar_id
*/
static function setVisit($seminar_id)
{
$type = get_object_type($seminar_id, words('fak inst sem'));
if ($type === 'fak') {
$type = 'inst';
}
if (self::getVisit($seminar_id) < object_get_visit($seminar_id, $type, false, false)) {
self::setVisitdates($seminar_id);
}
}
示例7: index_action
/**
* this action is the main action of the schedule-controller, setting the environment for the timetable,
* accepting a comma-separated list of days.
*
* @param string a list of an arbitrary mix of the numbers 0-6, separated with a comma (e.g. 1,2,3,4,5 (for Monday to Friday, the default))
*/
function index_action($days = false)
{
if ($GLOBALS['perm']->have_perm('admin')) {
$inst_mode = true;
}
$my_schedule_settings = $GLOBALS['user']->cfg->SCHEDULE_SETTINGS;
// set the days to be displayed
if ($days === false) {
if (Request::getArray('days')) {
$this->days = array_keys(Request::getArray('days'));
} else {
$this->days = array(0, 1, 2, 3, 4, 5, 6);
}
} else {
$this->days = explode(',', $days);
}
// try to find the correct institute-id
$institute_id = Request::option('institute_id', $SessSemName[1] ? $SessSemName[1] : Request::option('cid', false));
if (!$institute_id) {
$institute_id = $GLOBALS['user']->cfg->MY_INSTITUTES_DEFAULT;
}
if (!$institute_id || in_array(get_object_type($institute_id), words('inst fak')) === false) {
throw new Exception(sprintf(_('Kann Einrichtungskalendar nicht anzeigen!' . 'Es wurde eine ungültige Instituts-Id übergeben (%s)!', $institute_id)));
}
// load semester-data and current semester
$semdata = new SemesterData();
$this->semesters = $semdata->getAllSemesterData();
if (Request::option('semester_id')) {
$this->current_semester = $semdata->getSemesterData(Request::option('semester_id'));
} else {
$this->current_semester = $semdata->getCurrentSemesterData();
}
$this->entries = (array) CalendarInstscheduleModel::getInstituteEntries($GLOBALS['user']->id, $this->current_semester, 8, 20, $institute_id, $this->days);
Navigation::activateItem('/course/main/schedule');
PageLayout::setHelpKeyword('Basis.TerminkalenderStundenplan');
PageLayout::setTitle($GLOBALS['SessSemName']['header_line'] . ' - ' . _('Veranstaltungs-Stundenplan'));
$zoom = Request::int('zoom', 0);
$this->controller = $this;
$this->calendar_view = new CalendarWeekView($this->entries, 'instschedule');
$this->calendar_view->setHeight(40 + 20 * $zoom);
$this->calendar_view->setRange($my_schedule_settings['glb_start_time'], $my_schedule_settings['glb_end_time']);
$this->calendar_view->groupEntries();
// if enabled, group entries with same start- and end-date
URLHelper::addLinkParam('zoom', $zoom);
URLHelper::addLinkParam('semester_id', $this->current_semester['semester_id']);
$style_parameters = array('whole_height' => $this->calendar_view->getOverallHeight(), 'entry_height' => $this->calendar_view->getHeight());
$factory = new Flexi_TemplateFactory($this->dispatcher->trails_root . '/views');
PageLayout::addStyle($factory->render('calendar/stylesheet', $style_parameters));
if (Request::option('printview')) {
PageLayout::addStylesheet('print.css');
} else {
PageLayout::addStylesheet('print.css', array('media' => 'print'));
}
}
示例8: before_filter
/**
* Common tasks for all actions
*
* @param String $action Called action
* @param Array $args Possible arguments
*/
public function before_filter(&$action, &$args)
{
parent::before_filter($action, $args);
$course_id = $args[0];
$this->course_id = Request::option('cid', $course_id);
if (!get_object_type($this->course_id, array('sem')) || SeminarCategories::GetBySeminarId($this->course_id)->studygroup_mode || !$GLOBALS['perm']->have_studip_perm("tutor", $this->course_id)) {
throw new Trails_Exception(400);
}
PageLayout::addSqueezePackage('raumzeit');
PageLayout::setHelpKeyword('Basis.VeranstaltungenVerwaltenAendernVonZeitenUndTerminen');
PageLayout::setTitle(Course::findCurrent()->getFullname() . " - " . _('Blockveranstaltungstermine anlegen'));
}
示例9: getNotificationObjects
function getNotificationObjects($course_id, $since, $user_id)
{
$items = array();
$type = get_object_type($course_id, array('sem', 'inst', 'fak'));
if ($type == 'sem') {
$query = 'SELECT wiki.*, seminare.Name, ' . $GLOBALS['_fullname_sql']['full'] . ' as fullname
FROM wiki
JOIN auth_user_md5 USING (user_id)
JOIN user_info USING (user_id)
JOIN seminar_user ON (range_id = Seminar_id)
JOIN seminare USING (Seminar_id)
WHERE seminar_user.user_id = ? AND Seminar_id = ?
AND wiki.chdate > ?';
} else {
$query = 'SELECT wiki.*, Institute.Name, ' . $GLOBALS['_fullname_sql']['full'] . ' as fullname
FROM wiki
JOIN auth_user_md5 USING (user_id)
JOIN user_info USING (user_id)
JOIN user_inst ON (range_id = Institut_id)
JOIN Institute USING (Institut_id)
WHERE user_inst.user_id = ? AND Institut_id = ?
AND wiki.chdate > ?';
}
$wikipage_stmt = DBManager::get()->prepare("SELECT * FROM wiki\n WHERE keyword = ? AND range_id = ?\n AND version = ?");
$stmt = DBManager::get()->prepare($query);
$stmt->execute(array($user_id, $course_id, $since));
while ($row = $stmt->fetch()) {
// use correct text depending on type of object
if ($type == 'sem') {
if ($row['version'] > 1) {
$summary = sprintf('%s hat im Wiki der Veranstaltung "%s" die Seite "%s" geändert.', $row['fullname'], $row['Name'], $row['keyword']);
} else {
$summary = sprintf('%s hat im Wiki der Veranstaltung "%s" die Seite "%s" erstellt.', $row['fullname'], $row['Name'], $row['keyword']);
}
} else {
if ($row['version'] > 1) {
$summary = sprintf('%s hat im Wiki der Einreichtung "%s" die Seite "%s" geändert.', $row['fullname'], $row['Name'], $row['keyword']);
} else {
$summary = sprintf('%s hat im Wiki der Einreichtung "%s" die Seite "%s" erstellt.', $row['fullname'], $row['Name'], $row['keyword']);
}
}
$content = '';
if ($row['version'] > 1) {
$wikipage_stmt->execute(array($row['keyword'], $row['range_id'], $row['version'] - 1));
$old_page = $wikipage_stmt->fetch(PDO::FETCH_ASSOC);
$content = '<table>' . do_diff($old_page['body'], $row['body']) . '</table>';
} else {
$content = wikiReady($row['body']);
}
$items[] = new ContentElement('Wiki: ' . $row['keyword'], $summary, $content, $row['user_id'], $row['fullname'], URLHelper::getLink('wiki.php', array('cid' => $row['range_id'], 'keyword' => $row['keyword'])), $row['chdate']);
}
return $items;
}
示例10: before_filter
public function before_filter(&$action, &$args)
{
parent::before_filter($action, $args);
$this->institute_id = current($args);
if ($this->institute_id === '' || !in_array(get_object_type($this->institute_id), words('inst fak')) || !$GLOBALS['perm']->have_studip_perm("admin", $this->institute_id)) {
$this->set_status(403);
return FALSE;
}
$this->body_id = 'custom_avatar';
PageLayout::setTitle(getHeaderLine($this->institute_id) . ' - ' . _('Bild ändern'));
Navigation::activateItem('/admin/institute/details');
# choose base layout w/o infobox and set tabs
$layout = $GLOBALS['template_factory']->open('layouts/base_without_infobox');
$this->set_layout($layout);
}
示例11: StudipDocumentTree
/**
* constructor
*
* do not use directly, call TreeAbstract::GetInstance("StudipDocumentTree")
* @access private
*/
function StudipDocumentTree($args)
{
DbView::addView('core');
$this->range_id = $args['range_id'];
$this->entity_type = $args['entity_type'] ?: get_object_type($this->range_id);
if ($args['get_root_name']) {
list($name,) = array_values(get_object_name($this->range_id, $this->entity_type));
}
$this->root_name = $name;
$this->must_have_perm = $this->entity_type == 'sem' ? 'tutor' : 'autor';
$modules = new Modules();
$this->permissions_activated = $modules->getStatus('documents_folder_permissions', $this->range_id, $this->entity_type);
parent::TreeAbstract(); //calling the baseclass constructor
$this->tree_data['root']['permission'] = $this->default_perm;
}
示例12: before_filter
function before_filter(&$action, &$args)
{
parent::before_filter($action, $args);
$course_id = Request::option('cid');
if (isset($_SESSION['seminar_change_view_' . $course_id])) {
unset($_SESSION['seminar_change_view_' . $course_id]);
// Reset simulated view, redirect to administration page.
$this->redirect(URLHelper::getURL('dispatch.php/course/management'));
} elseif (get_object_type($course_id, array('sem')) && !SeminarCategories::GetBySeminarId($course_id)->studygroup_mode && in_array($GLOBALS['perm']->get_studip_perm($course_id), words('tutor dozent'))) {
// Set simulated view, redirect to overview page.
$_SESSION['seminar_change_view_' . $course_id] = 'autor';
$this->redirect(URLHelper::getURL('seminar_main.php'));
} else {
throw new Trails_Exception(400);
}
}
示例13: before_filter
/**
* common tasks for all actions
*/
function before_filter(&$action, &$args)
{
parent::before_filter($action, $args);
$this->course_id = $args[0];
if (!in_array($action, words('apply claim delete order_down order_up'))) {
$this->redirect($this->url_for('/apply/' . $action));
return false;
}
if (!get_object_type($this->course_id, array('sem'))) {
throw new Trails_Exception(400);
}
$course = Seminar::GetInstance($this->course_id);
$enrolment_info = $course->getEnrolmentInfo($GLOBALS['user']->id);
//Ist bereits Teilnehmer/Admin/freier Zugriff -> gleich weiter
if ($enrolment_info['enrolment_allowed'] && (in_array($enrolment_info['cause'], words('root courseadmin member')) || $enrolment_info['cause'] == 'free_access' && $GLOBALS['user']->id == 'nobody')) {
$redirect_url = UrlHelper::getUrl('seminar_main.php', array('auswahl' => $this->course_id));
if (Request::isXhr()) {
$this->response->add_header('X-Location', $redirect_url);
$this->render_nothing();
} else {
$this->redirect($redirect_url);
}
return false;
}
//Grundsätzlich verboten
if (!$enrolment_info['enrolment_allowed']) {
throw new AccessDeniedException($enrolment_info['description']);
}
PageLayout::setTitle($course->getFullname() . " - " . _("Veranstaltungsanmeldung"));
PageLayout::addSqueezePackage('enrolment');
if (Request::isXhr()) {
$this->set_layout(null);
$this->response->add_header('X-No-Buttons', 1);
$this->response->add_header('X-Title', PageLayout::getTitle());
$request = Request::getInstance();
foreach ($request as $key => $value) {
$request[$key] = studip_utf8decode($value);
}
} else {
$this->set_layout($GLOBALS['template_factory']->open('layouts/base'));
}
$this->set_content_type('text/html;charset=windows-1252');
if (Request::submitted('cancel')) {
$this->redirect(URLHelper::getURL('dispatch.php/course/details/', array('sem_id' => $this->course_id)));
}
}
示例14: StudipLitList
/**
* constructor
*
* do not use directly, call TreeAbstract::GetInstance("StudipLitList", $range_id)
* @access private
*/
function StudipLitList($range_id) {
DbView::addView('literatur');
if ($GLOBALS['LIT_LIST_FORMAT_TEMPLATE']){
$this->format_default = $GLOBALS['LIT_LIST_FORMAT_TEMPLATE'];
}
$this->range_id = $range_id;
$this->range_type = get_object_type($range_id);
if ($this->range_type == "user"){
$this->root_name = get_fullname($range_id);
} else {
$object_name = get_object_name($range_id, $this->range_type);
$this->root_name = $object_name['type'] . ": " . $object_name['name'];
}
$this->cat_element = new StudipLitCatElement();
parent::TreeAbstract(); //calling the baseclass constructor
}
示例15: getObjectRule
/**
* returns the lock rule object for the given id, else null
*
* @param string $object_id id of course, institute or user
* @param bool $renew if true, reloads the rule from database
* @return LockRule
*/
public static function getObjectRule($object_id, $renew = false)
{
if (!array_key_exists($object_id, self::$lockmap) || $renew) {
$object_type = get_object_type($object_id, words('sem inst user'));
if ($object_type) {
$methodmap = array('sem' => 'Seminar', 'inst' => 'Institute', 'fak' => 'Institute', 'user' => 'User');
$lr = call_user_func(array('LockRule', 'FindBy' . $methodmap[$object_type]), $object_id);
if ($lr) {
self::$lockmap[$object_id] = $lr->getId();
self::$lockrules[$lr->getId()] = $lr;
} else {
self::$lockmap[$object_id] = null;
}
}
}
return self::$lockmap[$object_id] ? self::$lockrules[self::$lockmap[$object_id]] : null;
}