本文整理汇总了PHP中Navigation::setBadgeNumber方法的典型用法代码示例。如果您正苦于以下问题:PHP Navigation::setBadgeNumber方法的具体用法?PHP Navigation::setBadgeNumber怎么用?PHP Navigation::setBadgeNumber使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Navigation
的用法示例。
在下文中一共展示了Navigation::setBadgeNumber方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct()
{
parent::__construct();
$top = new Navigation($this->getDisplayTitle(), PluginEngine::getURL($this, array('view' => 'tiles'), "presenting/overview"));
$top->setImage(Icon::create($this->getPluginURL() . "/assets/topicon.svg"));
$overview = new Navigation($this->getDisplayTitle(), PluginEngine::getURL($this, array(), "presenting/overview"));
$top->addSubNavigation("presenting", $overview);
$overview->addSubNavigation("overview", new AutoNavigation(_('Übersicht'), PluginEngine::getURL($this, array(), "presenting/overview")));
$overview->addSubNavigation("all", new AutoNavigation(_('Alle Plugins'), PluginEngine::getURL($this, array(), "presenting/all")));
$overview->addSubNavigation("tools", new AutoNavigation(_('Tools'), PluginEngine::getURL($this, array(), "tools/sidebar_graphics_generator")));
if ($GLOBALS['perm']->have_perm("autor")) {
$top->addSubNavigation("myplugins", new Navigation(_("Meine Plugins"), PluginEngine::getURL($this, array(), "myplugins/overview")));
}
if ($GLOBALS['perm']->have_perm("user")) {
$last_visit = UserConfig::get($GLOBALS['user']->id)->getValue("last_pluginmarket_visit");
if ($last_visit) {
$badge_number = MarketPlugin::countBySql("publiclyvisible = 1 AND approved = 1 AND published > ?", array($last_visit));
if ($badge_number > 0) {
$top->setBadgeNumber($badge_number);
}
}
}
if ($GLOBALS['perm']->have_perm("root")) {
$approving = new Navigation(_("Qualitätssicherung"), PluginEngine::getURL($this, array(), "approving/overview"));
$top->addSubNavigation("approving", $approving);
}
Navigation::addItem("/pluginmarket", $top);
$loginlink = new Navigation($this->getDisplayTitle(), PluginEngine::getURL($this, array(), "presenting/overview"));
$loginlink->setDescription(_("Laden Sie hier Plugins für Ihr Stud.IP herunter"));
Navigation::addItem("/login/pluginmarket", $loginlink);
NotificationCenter::addObserver($this, "triggerFollowingStudips", "PluginReleaseDidUpdateCode");
}
示例2: testBadgeNumber
public function testBadgeNumber()
{
$navigation = new Navigation('badge-test');
$this->assertFalse($navigation->hasBadgeNumber());
$this->assertEquals(0, $navigation->getBadgeNumber());
$navigation->setBadgeNumber(23);
$this->assertTrue($navigation->hasBadgeNumber());
$this->assertEquals(23, $navigation->getBadgeNumber());
}
示例3: getIconNavigation
function getIconNavigation($course_id, $last_visit, $user_id = null)
{
if (!$this->isActivated($course_id)) {
return;
}
$this->setupAutoload();
if ($GLOBALS['perm']->have_studip_perm('user', $course_id)) {
$num_entries = ForumVisit::getCount($course_id, ForumVisit::getVisit($course_id));
$text = ForumHelpers::getVisitText($num_entries, $course_id);
} else {
$num_entries = 0;
$text = 'Forum';
}
$navigation = new Navigation('forum', PluginEngine::getURL($this, array(), 'index/enter_seminar'));
$navigation->setBadgeNumber($num_entries);
if ($num_entries > 0) {
$navigation->setImage(Icon::create('forum+new', 'attention', ["title" => $text]));
} else {
$navigation->setImage(Icon::create('forum', 'inactive', ["title" => $text]));
}
return $navigation;
}
示例4: get_my_obj_values
/**
*
* @param unknown_type $my_obj
* @param unknown_type $user_id
* @param unknown_type $modules
*/
function get_my_obj_values(&$my_obj, $user_id, $modules = NULL)
{
$threshold = ($config = Config::get()->NEW_INDICATOR_THRESHOLD) ? strtotime("-{$config} days 0:00:00") : 0;
$db2 = new DB_seminar();
$db2->query("CREATE TEMPORARY TABLE IF NOT EXISTS myobj_" . $user_id . " ( object_id char(32) NOT NULL, PRIMARY KEY (object_id)) ENGINE = MEMORY");
$db2->query("REPLACE INTO myobj_" . $user_id . " (object_id) VALUES ('" . join("'),('", array_keys($my_obj)) . "')");
//dokumente
$unreadable_folders = array();
if (!$GLOBALS['perm']->have_perm('admin')) {
foreach (array_keys($my_obj) as $obj_id) {
if ($my_obj[$obj_id]['modules']['documents_folder_permissions'] || $my_obj[$obj_id]['obj_type'] == 'sem' && StudipDocumentTree::ExistsGroupFolders($obj_id)) {
$must_have_perm = $my_obj[$obj_id]['obj_type'] == 'sem' ? 'tutor' : 'autor';
if ($GLOBALS['perm']->permissions[$my_obj[$obj_id]['status']] < $GLOBALS['perm']->permissions[$must_have_perm]) {
$folder_tree = TreeAbstract::GetInstance('StudipDocumentTree', array('range_id' => $obj_id, 'entity_type' => $my_obj[$obj_id]['obj_type']));
$unreadable_folders = array_merge((array) $unreadable_folders, (array) $folder_tree->getUnReadableFolders($user_id));
}
}
}
}
$db2->query(get_obj_clause('dokumente a', 'Seminar_id', 'dokument_id', "(chdate > IFNULL(b.visitdate, {$threshold}) AND a.user_id !='{$user_id}')", 'documents', false, count($unreadable_folders) ? "AND a.range_id NOT IN('" . join("','", $unreadable_folders) . "')" : "", false, $user_id));
while ($db2->next_record()) {
$object_id = $db2->f('object_id');
if ($my_obj[$object_id]["modules"]["documents"]) {
$my_obj[$object_id]["neuedokumente"] = $db2->f("neue");
$my_obj[$object_id]["dokumente"] = $db2->f("count");
if ($my_obj[$object_id]['last_modified'] < $db2->f('last_modified')) {
$my_obj[$object_id]['last_modified'] = $db2->f('last_modified');
}
$nav = new Navigation('files');
if ($db2->f('neue')) {
$nav->setURL('folder.php?cmd=all');
$nav->setImage(Icon::create('files+new', 'attention', ["title" => sprintf(_('%s Dokumente, %s neue'), $db2->f('count'), $db2->f('neue'))]));
$nav->setBadgeNumber($db2->f('neue'));
} else {
if ($db2->f('count')) {
$nav->setURL('folder.php?cmd=tree');
$nav->setImage(Icon::create('files', 'inactive', ["title" => sprintf(_('%s Dokumente'), $db2->f('count'))]));
}
}
$my_obj[$object_id]['files'] = $nav;
}
}
//Ankündigungen
$db2->query(get_obj_clause('news_range a {ON_CLAUSE} LEFT JOIN news nw ON(a.news_id=nw.news_id AND UNIX_TIMESTAMP() BETWEEN date AND (date+expire))', 'range_id', 'nw.news_id', "(chdate > IFNULL(b.visitdate, {$threshold}) AND nw.user_id !='{$user_id}')", 'news', false, false, 'a.news_id', $user_id));
while ($db2->next_record()) {
$object_id = $db2->f('object_id');
$my_obj[$object_id]["neuenews"] = $db2->f("neue");
$my_obj[$object_id]["news"] = $db2->f("count");
if ($my_obj[$object_id]['last_modified'] < $db2->f('last_modified')) {
$my_obj[$object_id]['last_modified'] = $db2->f('last_modified');
}
$nav = new Navigation('news', '');
if ($db2->f('neue')) {
$nav->setURL('?new_news=true');
$nav->setImage(Icon::create('news+new', 'attention', ["title" => sprintf(_('%s Ankündigungen, %s neue'), $db2->f('count'), $db2->f('neue'))]));
$nav->setBadgeNumber($db2->f('neue'));
} else {
if ($db2->f('count')) {
$nav->setImage(Icon::create('news', 'inactive', ["title" => sprintf(_('%s Ankündigungen'), $db2->f('count'))]));
}
}
$my_obj[$object_id]['news'] = $nav;
}
// scm?
$db2->query(get_obj_clause('scm a', 'range_id', "IF(content !='',1,0)", "(chdate > IFNULL(b.visitdate, {$threshold}) AND a.user_id !='{$user_id}')", "scm", 'tab_name', false, false, $user_id));
while ($db2->next_record()) {
$object_id = $db2->f('object_id');
if ($my_obj[$object_id]["modules"]["scm"]) {
$my_obj[$object_id]["neuscmcontent"] = $db2->f("neue");
$my_obj[$object_id]["scmcontent"] = $db2->f("count");
$my_obj[$object_id]["scmtabname"] = $db2->f("tab_name");
if ($my_obj[$object_id]['last_modified'] < $db2->f('last_modified')) {
$my_obj[$object_id]['last_modified'] = $db2->f('last_modified');
}
$nav = new Navigation('scm', 'dispatch.php/course/scm');
if ($db2->f('count')) {
if ($db2->f('neue')) {
$image = Icon::create('infopage+new', 'new');
$nav->setBadgeNumber($db2->f('neue'));
if ($db2->f('count') == 1) {
$title = $db2->f('tab_name') . _(' (geändert)');
} else {
$title = sprintf(_('%s Einträge, %s neue'), $db2->f('count'), $db2->f('neue'));
}
} else {
$image = Icon::create('infopage', 'inactive');
if ($db2->f('count') == 1) {
$title = $db2->f('tab_name');
} else {
$title = sprintf(_('%s Einträge'), $db2->f('count'));
}
}
$nav->setImage($image, array('title' => $title));
}
//.........这里部分代码省略.........
示例5: checkParticipants
public static function checkParticipants(&$my_obj, $user_id, $object_id, $is_admission)
{
if ($my_obj["modules"]["participants"]) {
if (SeminarCategories::GetByTypeId($my_obj['status'])->studygroup_mode) {
$nav = new Navigation('participants', 'dispatch.php/course/studygroup/members/' . $object_id);
} else {
$nav = new Navigation('participants', 'dispatch.php/course/members/index');
}
if ($GLOBALS['perm']->have_perm('admin', $user_id) || in_array($my_obj['user_status'], words('dozent tutor'))) {
$count = 0;
$neue = 0;
$all_auto_inserts = AutoInsert::getAllSeminars(true);
$auto_insert_perm = Config::get()->AUTO_INSERT_SEM_PARTICIPANTS_VIEW_PERM;
$sql = "SELECT\n COUNT(a.user_id) as count,\n COUNT(IF((mkdate > IFNULL(b.visitdate, :threshold) AND a.user_id !=:user_id), a.user_id, NULL)) AS neue,\n MAX(IF((mkdate > IFNULL(b.visitdate, :threshold) AND a.user_id != :user_id), mkdate, 0)) AS last_modified\n FROM admission_seminar_user a\n LEFT JOIN object_user_visits b ON (b.object_id = a.seminar_id AND b.user_id = :user_id AND b.type ='participants')\n WHERE a.seminar_id = :course_id";
$statement = DBManager::get()->prepare($sql);
$statement->bindValue(':user_id', $user_id);
$statement->bindValue(':course_id', $object_id);
$statement->bindValue(':threshold', ($threshold = Config::get()->NEW_INDICATOR_THRESHOLD) ? strtotime("-{$threshold} days 0:00:00") : 0);
$statement->execute();
$result = $statement->fetch(PDO::FETCH_ASSOC);
if (!empty($result)) {
if ($GLOBALS['perm']->have_perm('admin', $user_id) || in_array($my_obj['user_status'], words('dozent tutor'))) {
$count = $result['count'];
$neue = $result['neue'];
if ($my_obj['last_modified'] < $result['last_modified']) {
$my_obj['last_modified'] = $result['last_modified'];
}
}
}
$sql = "SELECT\n COUNT(a . user_id) as count,\n COUNT(IF((mkdate > IFNULL(b.visitdate, :threshold) AND a.user_id !=:user_id), a.user_id, NULL)) AS neue,\n MAX(IF ((mkdate > IFNULL(b.visitdate, :threshold) AND a.user_id != :user_id), mkdate, 0)) AS last_modified\n FROM seminar_user a\n LEFT JOIN object_user_visits b ON(b . object_id = a . seminar_id AND b . user_id = :user_id AND b . type = 'participants')\n WHERE seminar_id = :course_id";
$statement = DBManager::get()->prepare($sql);
$statement->bindValue(':user_id', $user_id);
$statement->bindValue(':course_id', $object_id);
$statement->bindValue(':threshold', ($threshold = Config::get()->NEW_INDICATOR_THRESHOLD) ? strtotime("-{$threshold} days 0:00:00") : 0);
$statement->execute();
$result = $statement->fetch(PDO::FETCH_ASSOC);
if (!empty($result)) {
// show the participants-icon only if the module is activated and it is not an auto-insert-sem
if (in_array($object_id, $all_auto_inserts)) {
if ($GLOBALS['perm']->have_perm('admin', $user_id) && !$GLOBALS['perm']->have_perm($auto_insert_perm, $user_id)) {
return null;
} else {
if ($GLOBALS['perm']->permissions[$auto_insert_perm] > $GLOBALS['perm']->permissions[$my_obj['user_status']]) {
return null;
}
}
}
$count += $result['count'];
$neue += $result['neue'];
if ($GLOBALS['perm']->have_perm('admin', $user_id) || in_array($my_obj['user_status'], words('dozent tutor'))) {
if ($my_obj['last_modified'] < $result['last_modified']) {
$my_obj['last_modified'] = $result['last_modified'];
}
}
}
if ($neue) {
$nav->setImage(Icon::create('persons+new', 'attention', ["title" => sprintf('%s %s, %s %s', $count, _('Teilnehmende'), $neue, _('neue'))]));
$nav->setBadgeNumber($neue);
} else {
if ($count) {
$nav->setImage(Icon::create('persons', 'inactive', ["title" => sprintf('%s %s', $count, _('Teilnehmende'))]));
}
}
} else {
$nav->setImage(Icon::create('persons', 'inactive', ["title" => _('Teilnehmende')]));
}
return $nav;
}
return null;
}