public static function instance() { if (!isset(self::$instance)) { $class = __CLASS__; self::$instance = new $class(); } return self::$instance; }
function force_login($id) { $_SESSION['user'] = $id; $user = User::getUser($id); $_SESSION['user_level'] = $user->getTheme(); ActivityLog::log('login', $user, false, array()); db_do("INSERT INTO activity_log(user_id, action, whenit) VALUES('" . $user->getID() . "', 'login', NOW())"); return $user; }
/** * Load from row * * @param array $row * @return null */ function loadFromRow($row) { $result = parent::loadFromRow($row); if ($result && (int) $this->getComment() > 0) { $this->has_body = true; $this->has_footer = true; } // if return $result; }
namespace Ventus\Student; //============================================================================================ // Session, config //============================================================================================ require '../includes/php/bootstrap.php'; $SESSION = new \Zend_Session_Namespace('student', true); if (!isset($SESSION->logged_in)) { header('location: index.php?next=' . $_SERVER['PHP_SELF'] . '?' . $_SERVER['QUERY_STRING']); die; } //============================================================================================ // Load the Model and L10N //============================================================================================ $model = new ActivityLog($dbo); $dashboard = new Dashboard($dbo); if (\Ventus\Utilities\I18n\Translate::isAllowedLanguage($SESSION->corr_lang)) { $l10n->setLanguage($SESSION->corr_lang); \Locale::setDefault($SESSION->corr_lang); } $l10n->addResource(FS_L10N . '/header-external.json'); //============================================================================================ // Load the page requested by the user //============================================================================================ $this_page = "alog"; if (!isset($_GET['page'])) { $count_pending_follow_ups = $dashboard->fetchCountPendingFollowUps($SESSION->student_num); $all_student_activity = $model->listAllStudentActivity($SESSION->student_num); $l10n->addResource(__DIR__ . '/l10n/header.json'); $l10n->addResource(__DIR__ . '/l10n/activity-log.json');
<?php $user = User::instance(); $v = $user->validate($_POST); if ($v['valid']) { $u = User::instance()->add($_POST); ActivityLog::instance()->registration($u); LittleDropsOfCode::instance()->setPage('post-register'); } else { LittleDropsOfCode::instance()->setPage('register'); }
//============================================================================================ // Session, configuration file, localization constructor //============================================================================================ require '../includes/php/bootstrap.php'; $SESSION = new \Zend_Session_Namespace('internal', true); if (!isset($SESSION->lang)) { $SESSION->lang = DEFAULT_LANGUAGE; } \Locale::setDefault($SESSION->lang); $l10n->setLanguage($SESSION->lang); //============================================================================================ // Model //============================================================================================ $profile = new Profile($dbo); $alog = new ActivityLog($dbo); if (isset($_GET['student_num']) && ctype_digit($_GET['student_num'])) { $studentProfile = $profile->getProfile($_GET['student_num']); } //============================================================================================ // Load the content //============================================================================================ if (!isset($_GET['page'])) { $render = true; $thisPage = 'activity-log'; if (!empty($studentProfile)) { $all_student_activity = $alog->listAllActivity($_GET['student_num']); $l10n->addResource(__DIR__ . '/l10n/activity-log.json'); $viewFile = 'views/activity-log.php'; } }
/** * Write Activity Log * * @param ProjectObject $object * @param User $user * @param string $action * @param string $comment * @return null */ function write($object, $user, $action, $comment = null) { if (!instance_of($user, 'User') && !instance_of($user, 'AnonymousUser')) { $user =& get_logged_user(); if (!instance_of($user, 'User')) { return false; } // if } // if $activity_log = new ActivityLog(); $activity_log->setAttributes(array('object_id' => $object->getId(), 'project_id' => $object->getProjectId(), 'action' => $action, 'comment' => $comment)); $activity_log->setCreatedBy($user); return $activity_log->save(); }