Example #1
0
 /**
  * get list of all available log actions
  */
 function get_log_actions()
 {
     $log_count = LogEvent::countByActions();
     $actions = LogAction::findBySQL('1 ORDER BY name');
     $log_actions = array();
     foreach ($actions as $action) {
         $log_actions[$action->getId()] = $action->toArray();
         $log_actions[$action->getId()]['log_count'] = (int) $log_count[$action->getId()];
     }
     return $log_actions;
 }
Example #2
0
 /**
  * Finds all seminars by given search string. Searches for the name of
  * existing or already deleted seminars.
  * 
  * @param string $needle The needle to search for.
  * @return array 
  */
 public static function searchSeminar($needle)
 {
     $result = array();
     // search for active seminars
     $courses = Course::findBySQL("VeranstaltungsNummer LIKE CONCAT('%', :needle, '%')\n                     OR seminare.Name LIKE CONCAT('%', :needle, '%')", array(':needle' => $needle));
     foreach ($courses as $course) {
         $title = sprintf('%s %s (%s)', $course->VeranstaltungsNummer, my_substr($course->name, 0, 40), $course->start_semester->name);
         $result[] = array($course->getId(), $title);
     }
     // search deleted seminars
     // SemName and Number is part of info field, old id (still in DB) is in affected column
     $log_action_ids_archived_seminar = SimpleORMapCollection::createFromArray(LogAction::findBySQL("name IN ('SEM_ARCHIVE', 'SEM_DELETE_FROM_ARCHIVE')"))->pluck('action_id');
     $log_events_archived_seminar = LogEvent::findBySQL("info LIKE CONCAT('%', ?, '%')\n                AND action_id IN (?) ", array($needle, $log_action_ids_archived_seminar));
     foreach ($log_events_archived_seminar as $log_event) {
         $title = sprintf('%s (%s)', my_substr($log_event->info, 0, 40), _('gelöscht'));
         $result[] = array($log_event->affected_range_id, $title);
     }
     return $result;
 }