示例#1
0
文件: user.php 项目: eguicciardi/ada
     $olelem = CDOMElement::create('ol');
     foreach ($new_nodes as $node) {
         if (strpos($node['id_nodo'], $courseId) !== false) {
             $lielem = CDOMElement::create('li');
             $link = CDOMElement::create('a', 'href:view.php?id_node=' . $node['id_nodo'] . '&id_course=' . $courseId . '&id_course_instance=' . $courseInstanceId);
             $link->addChild(new CText($node['nome']));
             $lielem->addChild($link);
             $olelem->addChild($lielem);
             unset($lielem);
             unset($link);
         }
     }
     $new_nodes_html = $olelem->getHtml();
 }
 // @author giorgio 24/apr/2013 forum messages (NOTES!!!!! BE WARNED: THESE ARE NOTES!!!)
 $msg_forum_count = MultiPort::count_new_notes($userObj, $courseInstanceId);
 //display a direct link to forum if there are new messages
 if ($msg_forum_count > 0) {
     $link = CDOMElement::create('a', 'href:main_index.php?op=forum&id_course=' . $courseId . '&id_course_instance=' . $courseInstanceId);
     $link->addChild(new CText($msg_forum_count));
     $msg_forum_count = $link->getHtml();
     unset($link);
 }
 // @author giorgio 24/apr/2013 private messages
 $msg_simple_count = 0;
 $msg_simpleAr = MultiPort::getUserMessages($userObj);
 foreach ($msg_simpleAr as $msg_simple_provider) {
     $msg_simple_count += count($msg_simple_provider);
 }
 // @author giorgio 24/apr/2013 agenda messages
 $msg_agenda_count = 0;
示例#2
0
 /**
  * checkWhatsNew
  * @author giorgio 24/apr/2013
  *
  *
  * @param ADALoggableUser $userObj	user data to check for something new
  * @param int $courseInstanceId		course instance id to check for something new
  *
  * @return boolean true if there's some new messages for passed user in passed course instance
  */
 public static function checkWhatsNew($userObj, $courseInstanceId, $courseId = 0)
 {
     // new nodes in course
     $userObj->updateWhatsNew();
     $count_new_nodes = 0;
     foreach ($userObj->getwhatsnew() as $whatsnewintester) {
         foreach ($whatsnewintester as $whatsnewelem) {
             if (strpos($whatsnewelem['id_nodo'], $courseId) !== false) {
                 $count_new_nodes++;
             }
         }
     }
     // new messages in forum, AKA NOTES!!!
     $msg_forum_count = MultiPort::count_new_notes($userObj, $courseInstanceId);
     return $count_new_nodes > 0 || $msg_forum_count > 0;
 }