Example #1
0
 public static function createNotation($va, $content, $author = '')
 {
     if (empty($author)) {
         $author = Auth::consoleuser()->get()->cid;
     }
     $audit_log = new AuditLog();
     $audit_log->author = $author;
     $audit_log->va = $va;
     $audit_log->content = $content;
     $audit_log->save();
 }
Example #2
0
 public static function registerLog($log_type_id, $description)
 {
     if (Auth::check()) {
         $log = new AuditLog();
         $log->log_type_id = $log_type_id;
         $log->description = $description;
         $log->user_id = Session::get('user')->id;
         $log->save();
     } else {
         return View::make('error/error');
     }
 }
Example #3
0
 public function executeLogout(sfWebRequest $request)
 {
     $newLog = new AuditLog();
     $action = 'User has logged out from  Student Record Management System';
     $newLog->addNewLogInfo($this->getUser()->getAttribute('userId'), $action);
     $this->getUser()->setAuthenticated(false);
     $this->getUser()->getAttributeHolder()->remove('userId');
     $this->getUser()->getAttributeHolder()->remove('departmentId');
     $this->getUser()->getAttributeHolder()->remove('departmentName');
     $this->getUser()->getAttributeHolder()->remove('sectionIds');
     $this->getUser()->setFlash('notice', 'You have been logged out!');
     $this->redirect('student/index');
 }
Example #4
0
 protected function _setupEnvironment()
 {
     error_reporting(E_ALL | E_STRICT);
     set_include_path($this->getPath('library') . PATH_SEPARATOR . $this->getPath('models') . PATH_SEPARATOR . $this->getPath('controllers') . PATH_SEPARATOR . get_include_path());
     require_once 'WebVista/Model/ORM.php';
     require_once 'User.php';
     require_once 'Person.php';
     require_once 'Zend/Session.php';
     require_once 'WebVista/Session/SaveHandler.php';
     Zend_Session::setSaveHandler(new WebVista_Session_SaveHandler());
     Zend_Session::start();
     require_once 'Zend/Loader.php';
     Zend_Loader::registerAutoLoad();
     $sessionTimeout = ini_get('session.gc_maxlifetime') - 5 * 60;
     Zend_Registry::set('sessionTimeout', $sessionTimeout);
     $this->_config = new Zend_Config_Ini($this->getPath('application') . "/config/app.ini", APPLICATION_ENVIRONMENT);
     Zend_Registry::set('config', $this->_config);
     Zend_Registry::set('baseUrl', substr($_SERVER['PHP_SELF'], 0, strpos(strtolower($_SERVER['PHP_SELF']), 'index.php')));
     Zend_Registry::set('basePath', $this->getPath('base') . DIRECTORY_SEPARATOR);
     try {
         date_default_timezone_set(Zend_Registry::get('config')->date->timezone);
     } catch (Zend_Exception $e) {
         die($e->getMessage());
     }
     AuditLog::setDbConfig($this->_config->database->toArray());
     // this MUST be required as this is used as DB connection
     // register shutdown function
     register_shutdown_function(array('AuditLog', 'closeConnection'));
     ob_start();
     // this MUST be required after register shutdown
     return $this;
 }
Example #5
0
 public static function addLog($strType, $intId, $strName, $strAction, $strDescription = "")
 {
     global $objLiveUser, $_CONF;
     if (Setting::selectByName("audit_enable")) {
         $objLog = new AuditLog();
         $objLog->setAccountId($_CONF['app']['account']->getId());
         $objLog->setType($strType);
         $objLog->setTypeId($intId);
         $objLog->setTypeName($strName);
         $objLog->setUserId($objLiveUser->getProperty("auth_user_id"));
         $objLog->setUserName($objLiveUser->getProperty("name"));
         $objLog->setAction($strAction);
         $objLog->setDescription($strDescription);
         $objLog->save();
     }
 }
Example #6
0
 public function delete()
 {
     parent::$__object = "Alias";
     parent::$__table = "pcms_alias";
     if (class_exists("AuditLog")) {
         AuditLog::addLog(AUDIT_TYPE_ALIAS, $this->getId(), $this->getAlias(), "delete");
     }
     return parent::delete();
 }
Example #7
0
 public function persist()
 {
     if ($this->_ormPersist) {
         return parent::persist();
     }
     if ($this->shouldAudit()) {
         $sql = $this->toSQL();
         AuditLog::appendSql($sql);
     }
 }
Example #8
0
 public function save($blnSaveModifiedDate = TRUE)
 {
     self::$object = "Setting";
     self::$table = "pcms_setting";
     $blnReturn = parent::save($blnSaveModifiedDate);
     $objSettingTemplate = SettingTemplate::selectByPk($this->getSettingId());
     if (class_exists("AuditLog")) {
         AuditLog::addLog(AUDIT_TYPE_SETTING, $this->getId(), $objSettingTemplate->getName(), "edit", $this->getValue());
     }
     return $blnReturn;
 }
Example #9
0
 public function persist()
 {
     if (!strlen($this->ip_address) > 0 && isset($_SERVER['REMOTE_ADDR'])) {
         $this->ip_address = $_SERVER['REMOTE_ADDR'];
     }
     if (!$this->userId) {
         $audit->userId = Registry::get('user_id');
     }
     if (self::$_synchronousAudits || $this->_ormPersist) {
         return parent::persist();
     }
     if ($this->shouldAudit()) {
         $sql = $this->toSQL();
         AuditLog::appendSql($sql);
     }
 }
Example #10
0
 public function delete()
 {
     global $_CONF, $_PATHS;
     parent::$__object = "Feed";
     parent::$__table = "pcms_feed";
     $objElementFeeds = ElementFeed::selectByFeed($this->getId());
     foreach ($objElementFeeds as $objElementFeed) {
         $objElement = Element::selectByPK($objElementFeed->getElementId());
         //*** Remove dynamic element.
         $objElement->delete();
     }
     //*** Remove cached feed.
     @unlink($_PATHS['upload'] . $this->getHash());
     if (class_exists("AuditLog")) {
         AuditLog::addLog(AUDIT_TYPE_FEED, $this->getId(), $this->getFeed(), "delete");
     }
     return parent::delete();
 }
Example #11
0
 public function login()
 {
     header("Content-Type:text/html; charset=utf-8");
     $username = isset($_POST['username']) ? $_POST['username'] : '';
     $password = isset($_POST['password']) ? $_POST['password'] : '';
     //        print_r($username);
     $sqlAuth = new SQLAuthenticator();
     if ($SQLRet = $sqlAuth->authenticate($username, $password)) {
         AuditLog::writeLog('login in', session('userid'));
         $this->getUserPermission();
         $this->success("login success 1  ");
     } else {
         if ($ldapRet = $this->authenticate($username, $password)) {
             AuditLog::writeLog('login in', session('userid'));
             $this->getUserPermission();
             $this->success("login success 2  ");
         } else {
             $this->error('Your account may be disabled or blocked or the username/password you entered is incorrect.');
         }
     }
 }
 /**
  * @param array $logs
  */
 protected function processLogs($logs)
 {
     $auditLogs = array();
     $auditRequestId = $this->getAuditRequestId();
     $userId = Yii::app()->hasComponent('user') ? Yii::app()->user->id : 0;
     $audit = Yii::app()->getModule('audit');
     $commandBuilder = $audit->getDbConnection()->getCommandBuilder();
     foreach ($logs as $log) {
         $message = explode("\n", $log[0]);
         $file = count($message) > 1 ? array_pop($message) : '';
         $message = implode("\n", $message);
         $auditLogs[] = array('level' => $log[1], 'category' => $log[2], 'message' => AuditHelper::pack($message), 'file' => $file, 'audit_request_id' => $auditRequestId, 'user_id' => $userId, 'created' => (int) $log[3]);
         // save 100 rows at a time, more than this causes an issue
         if (count($auditLogs) > 100) {
             $commandBuilder->createMultipleInsertCommand(AuditLog::model()->tableName(), $auditLogs)->execute();
             $auditLogs = array();
         }
     }
     if ($auditLogs) {
         $commandBuilder->createMultipleInsertCommand(AuditLog::model()->tableName(), $auditLogs)->execute();
     }
 }
Example #13
0
 public function duplicate($strNewName = "")
 {
     global $objLang, $_CONF, $objLiveUser;
     if ($this->id > 0) {
         //*** Cache the name of the current template.
         $strName = $this->name;
         if (!empty($strNewName)) {
             //*** Set the name of the duplicate template.
             $this->name = sprintf($strNewName, $strName);
         }
         //*** Duplicate the template.
         $objReturn = parent::duplicate();
         if (class_exists("AuditLog")) {
             AuditLog::addLog(AUDIT_TYPE_TEMPLATE, $this->getId(), $strName, "duplicate", $objReturn->getId());
         }
         if (class_exists("AuditLog")) {
             AuditLog::addLog(AUDIT_TYPE_TEMPLATE, $objReturn->getId(), $objReturn->getName(), "create");
         }
         //*** Reset the name of the current template.
         $this->name = $strName;
         //*** Duplicate the fields of the current template.
         $objFields = $this->getFields();
         foreach ($objFields as $objField) {
             $objNewField = $objField->duplicate();
             $objNewField->setTemplateId($objReturn->getId());
             $objNewField->setUsername($objLiveUser->getProperty("name"));
             $objNewField->save();
         }
         //*** Copy any child templates to the duplicate.
         $strSql = sprintf("SELECT * FROM pcms_template WHERE parentId = '%s' AND accountId = '%s'", $this->id, $_CONF['app']['account']->getId());
         $objTemplates = Template::select($strSql);
         foreach ($objTemplates as $objTemplate) {
             $objTemplate->copy($objReturn->getId());
         }
         return $objReturn;
     }
     return NULL;
 }
Example #14
0
 public function persist()
 {
     if (!strlen($this->ipAddress) > 0 && isset($_SERVER['REMOTE_ADDR'])) {
         $this->ipAddress = $_SERVER['REMOTE_ADDR'];
     }
     if (self::$_processedAudits) {
         $this->startProcessing = date('Y-m-d H:i:s');
         $this->endProcessing = date('Y-m-d H:i:s');
     }
     if (!$this->userId) {
         $identity = Zend_Auth::getInstance()->getIdentity();
         if ($identity) {
             $this->userId = $identity->personId;
         }
     }
     if (self::$_synchronousAudits || $this->_ormPersist) {
         return parent::persist();
     }
     if ($this->shouldAudit()) {
         $sql = $this->toSQL();
         AuditLog::appendSql($sql);
     }
 }
Example #15
0
 public function executeEditstudent(sfWebRequest $request)
 {
     $sectionId = $request->getParameter('sectionId');
     $this->program_section = Doctrine_Core::getTable('ProgramSection')->findOneById($sectionId);
     $this->forward404Unless($this->program_section);
     $this->forward404Unless($this->student = Doctrine_Core::getTable('Student')->find(array($request->getParameter('studentId'))), sprintf('Object student does not exist (%s).', $request->getParameter('studentId')));
     $this->frontendStudentForm = new FrontendStudentForm($this->student);
     if ($request->isMethod('POST')) {
         $this->frontendStudentForm->bind($request->getParameter('studentform'));
         if ($this->frontendStudentForm->isValid()) {
             $formData = $this->frontendStudentForm->getValues();
             $studentUID = $formData['student_uid'];
             $name = $formData['name'];
             $fathersName = $formData['fathers_name'];
             $grandfathersName = $formData['grandfathers_name'];
             $motherName = $formData['mother_name'];
             $dateOfBirth = $formData['date_of_birth'];
             $sex = $formData['sex'];
             $nationality = $formData['nationality'];
             $birthLocation = $formData['birth_location'];
             $residenceCity = $formData['residence_city'];
             $residenceWoreda = $formData['residence_woreda'];
             $residenceKebele = $formData['residence_kebele'];
             $residenceHourseNumber = $formData['residence_house_number'];
             $ethnicity = $formData['ethnicity'];
             $telephone = $formData['telephone'];
             $email = $formData['email'];
             if (!Doctrine_Core::getTable('Student')->findOneByStudentUid($studentUID)) {
                 $this->student->setStudentUid($studentUID);
                 $this->student->setName($name);
                 $this->student->setFathersName($fathersName);
                 $this->student->setGrandfathersName($grandfathersName);
                 $this->student->setMotherName($motherName);
                 $this->student->setDateOfBirth($dateOfBirth);
                 $this->student->setSex($sex);
                 $this->student->setAdmissionYear(date('Y'));
                 $this->student->setNationality($nationality);
                 $this->student->setBirthLocation($birthLocation);
                 $this->student->setResidenceCity($residenceCity);
                 $this->student->setResidenceWoreda($residenceWoreda);
                 $this->student->setResidenceKebele($residenceKebele);
                 $this->student->setResidenceHouseNumber($residenceHourseNumber);
                 $this->student->setEthinicity($ethnicity);
                 $this->student->setTelephone($telephone);
                 $this->student->setEmail($email);
                 $this->student->save();
                 $auditlog = new AuditLog();
                 $auditlog->addNewLogInfo($this->getUser()->getAttribute('userId'), 'Performed Student Profile Edit');
                 $this->getUser()->setFlash('notice', 'Student Profile Edit Was Successful ');
                 $this->redirect('programsection/sectiondetail?id=' . $sectionId);
             } else {
                 $this->getUser()->setFlash('error', 'Error: Duplicate Student ID Number Is Not Allowed');
             }
         } else {
             $this->getUser()->setFlash('error', 'Error with student edit form');
         }
     }
 }
 /**
  *  Event AuditLogin
  *  Record in a login table the users login.
  *  This requires an AuditLog object and auditlog table
  * @param EventControler eventcontroler instance
  */
 function eventAuditLogin(EventControler $evtcl)
 {
     if (is_object($_SESSION['AuditLog'])) {
         $_SESSION['AuditLog']->user = $this->{$this->getUsernameField()};
         $_SESSION['AuditLog']->action = "login";
         $_SESSION['AuditLog']->add();
     } else {
         $AuditLog = new AuditLog();
         $AuditLog->init();
         $AuditLog->user = $this->{$this->getUsernameField()};
         $AuditLog->action = "login";
         $AuditLog->object = get_class($this);
         $AuditLog->add();
     }
 }
<?php

include "DBconfig.php";
include "AuditClass.php";
//$Log=new AuditLog($dbHost,$dbUser,$dbPwd,$dbName,date('Y-m-d'),"","");
//$Log=new AuditLog($dbHost,$dbUser,$dbPwd,$dbName,date('Y-m-d'),'','');
$AuditTimer = new AuditLog($dbHost, $dbUser, $dbPwd, $dbName, date('Y-m-d'), '', '');
$result = $AuditTimer->Display();
?>
<html>
 <head>
    <?php 
include "header.php";
?>
    <script type="text/javascript">
       $(document).ready( function () {
 	   $('#AuditTimerDetails').dataTable({
			"iDisplayLength": 20,
			"iDisplayStart": 20
			});
	    Audit=setTimeout(function(){window.location.href=document.URL;},180000);		
	  } );    
    </script>      
</head>
 <body>
	<?php 
include "Menu.php";
?>
   <div class="positionDownload"><a href="AuditTimerDownload.php">Download<a/></div><br/>
   <div class="TableTitle TableDetails">Audit Log Details</div><hr/>   
   <table id="AuditTimerDetails" class="display">
Example #18
0
 public function executeCancelregrade(sfWebRequest $request)
 {
     #1. get requests
     $this->departmentName = $this->getUser()->getAttribute('departmentName');
     $this->programSectionId = $request->getParameter('sectionId');
     $this->studentId = $request->getParameter('studentId');
     $this->enrollmentId = $request->getParameter('enrollmentId');
     $this->studentCourseGradeId = $request->getParameter('studentCourseGradeId');
     ## for new course
     #2. Update new course - Deactivate new course
     $newCourse = Doctrine_Core::getTable('StudentCourseGrade')->findOneById($this->studentCourseGradeId);
     $this->forward404Unless($newCourse);
     $newCourse->setRegradeStatus(6);
     $newCourse->save();
     #3. Update old course - Deactivate the course regrade_status=5
     #3.1 Get normal registraion by enrollmentInfoId
     $normalRegistration = Doctrine_Core::getTable('Registration')->getNormalRegistrationByEnrollmentId($this->enrollmentId);
     #3.2 Get Old course/ Old course registered under normal registration
     $oldCourse = Doctrine_Core::getTable('StudentCourseGrade')->getOneNormalRegistrationCourse($normalRegistration->getId(), $newCourse->getCourseId());
     $oldCourse->setRegradeStatus(5);
     $oldCourse->save();
     #4 Redirect to where it was
     $newLog = new AuditLog();
     $action = 'User has Cancelled Regrade Process .....';
     $newLog->addNewLogInfo($this->getUser()->getAttribute('userId'), $action);
     $this->getUser()->setFlash('notice', 'Regrade Cancellation Was Successful');
     $this->redirect('regrade/studentRegradeDetail?sectionId=' . $this->programSectionId . '&studentId=' . $this->studentId . '&enrollmentId=' . $this->enrollmentId);
 }
Example #19
0
    if (!$objLiveUser->isLoggedIn() || !empty($strUsername) && $objLiveUser->getProperty('handle') != $strUsername) {
        //*** Log in using LiveUser.
        if (empty($strUsername) || $strCmd === 'User::add') {
            $objLiveUser->login(null, null, true, false, $_CONF['app']['account']->getId());
        } else {
            if (!$objLiveUser->login($strUsername, $strPassword, $blnRemember, false, $_CONF['app']['account']->getId())) {
                $objErrors = $objLiveUser->getErrors();
                if (count($objErrors) > 0) {
                    foreach ($objErrors as $objError) {
                        echo $objError["message"] . "<br />";
                    }
                    die('User could not log in.');
                }
            } else {
                //*** Clear old audit logs.
                AuditLog::cleanLog();
                header("Location: " . Request::getURI("http"));
                exit;
            }
        }
    }
}
if (!$objLiveUser->isLoggedIn() && $intCatId != NAV_MYPUNCH_LOGIN && $intCatId != NAV_MYPUNCH_NOACCOUNT) {
    //*** Redirect to the login screen.
    if ($_CONF['app']['secureLogin']) {
        header("Location: " . Request::getURI("https") . "/?cid=" . NAV_MYPUNCH_LOGIN);
    } else {
        header("Location: " . Request::getURI("http") . "/?cid=" . NAV_MYPUNCH_LOGIN);
    }
    exit;
} else {
Example #20
0
 public function delete()
 {
     self::$object = "TemplateField";
     self::$table = "pcms_template_field";
     if (class_exists("AuditLog")) {
         AuditLog::addLog(AUDIT_TYPE_TEMPLATEFIELD, $this->getId(), $this->getName(), "delete", $this->getTemplateId());
     }
     $objElementField = ElementField::deleteByTemplateId($this->id);
     return parent::delete();
 }
Example #21
0
 public function duplicate($strNewName = "")
 {
     global $objLang, $_CONF;
     if ($this->id > 0) {
         //*** Cache the name of the current element.
         $strName = $this->name;
         if (!empty($strNewName)) {
             //*** Set the name of the duplicate element.
             $this->name = sprintf($strNewName, $strName);
         }
         //*** Duplicate the element.
         $objReturn = parent::duplicate();
         if (class_exists("AuditLog")) {
             AuditLog::addLog(AUDIT_TYPE_STORAGE, $this->getId(), $strName, "duplicate", $objReturn->getId());
         }
         if (class_exists("AuditLog")) {
             AuditLog::addLog(AUDIT_TYPE_STORAGE, $objReturn->getId(), $objReturn->getName(), "create");
         }
         //*** Reset the name of the current element.
         $this->name = $strName;
         //*** Copy any child elements to the duplicate.
         $strSql = sprintf("SELECT * FROM pcms_storage_item WHERE parentId = '%s' AND accountId = '%s'", $this->id, $_CONF['app']['account']->getId());
         $objElements = StorageItem::select($strSql);
         foreach ($objElements as $objElement) {
             $objElement->copy($objReturn->getId());
         }
         return $objReturn;
     }
     return NULL;
 }
Example #22
0
 public function executeWithdrawstudent(sfWebRequest $request)
 {
     $this->showWithdrawalForm = FALSE;
     $enrollmentId = null;
     $studentId = $request->getParameter('studentId');
     $this->student = Doctrine_Core::getTable('Student')->findOneById($studentId);
     $this->forward404Unless($this->student);
     foreach ($this->student->getEnrollmentInfos() as $enrollment) {
         if (!$enrollment->getLeftout()) {
             if ($enrollment->getSemesterAction() == sfConfig::get('app_registered_semester_action') || $enrollment->getSemesterAction() == sfConfig::get('app_enrolled_semester_action')) {
                 $enrollmentId = $enrollment->getId();
                 $this->showWithdrawalForm = TRUE;
             }
         }
     }
     $this->withdrawalForm = new FrontendStudentWithdrawalForm($enrollmentId);
     if ($request->isMethod('POST')) {
         $this->withdrawalForm->bind($request->getParameter('withdrawalform'));
         if ($this->withdrawalForm->isValid()) {
             $formData = $this->withdrawalForm->getValues();
             $ac = $formData['ac'];
             $remark = $formData['remark'];
             $enrollmentId = $formData['enrollment_info_id'];
             ##ID of either ADR or WITHDRAWAL
             if ($enrollmentId == '' || $ac == '') {
                 $this->getUser()->setFlash('error', 'Error with Add Form');
                 $this->redirect('readmission/withdraw/?studentId=' . $this->student->getId());
             }
             $studentWitdrawal = new StudentWithdrawal();
             $studentWitdrawal->setEnrollmentInfoId($enrollmentId);
             $studentWitdrawal->setAC($ac);
             $studentWitdrawal->setRemark($remark);
             $studentWitdrawal->setWithdrawalDate(date('Y-m-d H:m:s'));
             $studentWitdrawal->save();
             $enrollmentToWithdraw = Doctrine_Core::getTable('EnrollmentInfo')->findOneById($enrollmentId);
             $enrollmentToWithdraw->withdrawEnrollment();
             $enrollmentToWithdraw->save();
             $auditlog = new AuditLog();
             $auditlog->addNewLogInfo($this->getUser()->getAttribute('userId'), 'Performed Student Withdrawal');
             $this->getUser()->setFlash('notice', 'Student Withdrawal was Successful ');
             $this->redirect('withdraw/index');
         } else {
             $this->getUser()->setFlash('error', 'Error with Withdrawal Form');
         }
     }
 }
Example #23
0
 public function persist($preQueries = null, $postQueries = null)
 {
     $ret = true;
     Orm::$_adapter->beginTransaction();
     try {
         if ($preQueries !== null) {
             if (!is_array($preQueries)) {
                 $preQueries = array($preQueries);
             }
             foreach ($preQueries as $sql) {
                 Orm::$_adapter->query($sql);
             }
         }
         foreach ($this->queries as $sql) {
             //Orm::$_adapter->query($sql);
             $stmt = Orm::$_adapter->getConnection()->exec($sql);
         }
         if ($postQueries !== null) {
             if (!is_array($postQueries)) {
                 $postQueries = array($postQueries);
             }
             foreach ($postQueries as $sql) {
                 Orm::$_adapter->query($sql);
             }
         }
         if (isset($this->auditLogQueries[0])) {
             AuditLog::appendSql($this->auditLogQueries);
         }
         Orm::$_adapter->commit();
     } catch (Exception $e) {
         $ret = false;
         Orm::$_adapter->rollBack();
         trigger_error($e->getMessage(), E_USER_NOTICE);
     }
     return $ret;
 }
Example #24
0
 public function executeRegisterwithadd(sfWebRequest $request)
 {
     $courseToAddRegisterArray = array();
     ##get course and enrollmentInfoObj for Add Registration
     $courseToAddRegisterArray[] = $request->getParameter('courseId');
     $enrollmentInfoObjToAdd = Doctrine_Core::getTable('EnrollmentInfo')->findOneById($request->getParameter('enrollmentId'));
     $this->forward404Unless($enrollmentInfoObjToAdd);
     ##Disable previous course
     $oneScg = Doctrine_Core::getTable('StudentCourseGrade')->getOneStudentOneCourseGrade($enrollmentInfoObjToAdd->getStudentId(), $request->getParameter('courseId'));
     $this->forward404Unless($oneScg);
     $oneScg->setIsCalculated(FALSE);
     $oneScg->save();
     $addRegistration = new Registration();
     $anyValue = $addRegistration->doRegistration(sfConfig::get('app_add_registration'), $enrollmentInfoObjToAdd, $courseToAddRegisterArray);
     ## clear attributes holding session values
     $this->getUser()->getAttributeHolder()->remove('courseIdToAdd');
     $this->getUser()->getAttributeHolder()->remove('enrollmentInfoObjToAdd');
     $newLog = new AuditLog();
     $action = 'User Registered Student With Add System - Student has Added Course';
     $newLog->addNewLogInfo($this->getUser()->getAttribute('userId'), $action);
     $this->getUser()->setFlash('notice', 'Registration was successfull ' . $anyValue);
     $this->redirect('registration/index');
 }
 public function persist($preQueries = null, $postQueries = null)
 {
     $ret = true;
     $db = Zend_Registry::get('dbAdapter');
     $db->beginTransaction();
     try {
         if ($preQueries !== null) {
             if (!is_array($preQueries)) {
                 $preQueries = array($preQueries);
             }
             foreach ($preQueries as $sql) {
                 $stmt = $db->query($sql);
                 $stmt->closeCursor();
             }
         }
         foreach ($this->queries as $sql) {
             $stmt = $db->query($sql);
             $stmt->closeCursor();
         }
         if ($postQueries !== null) {
             if (!is_array($postQueries)) {
                 $postQueries = array($postQueries);
             }
             foreach ($postQueries as $sql) {
                 $stmt = $db->query($sql);
                 $stmt->closeCursor();
             }
         }
         if (isset($this->auditLogQueries[0])) {
             AuditLog::appendSql($this->auditLogQueries);
         }
         $db->commit();
     } catch (Exception $e) {
         $ret = false;
         $db->rollBack();
         trigger_error($e->getMessage(), E_USER_NOTICE);
     }
     return $ret;
 }
Example #26
0
 /**
  * Set SQL queries
  * @param array SQL queries
  */
 public static function setSql(array $sql)
 {
     self::$_sql = $sql;
 }
<?php

include "DBconfig.php";
include "AuditClass.php";
$Afrom = $_GET['fdate'];
$Ato = $_GET['tdate'];
//$Log=new AuditLog($dbHost,$dbUser,$dbPwd,$dbName,date('Y-m-d'),"","");
//$Log=new AuditLog($dbHost,$dbUser,$dbPwd,$dbName,date('Y-m-d'),'','');
$AuditHistory = new AuditLog($dbHost, $dbUser, $dbPwd, $dbName, '', $Afrom, $Ato);
$result = $AuditHistory->Display();
?>
<html>
 <head>
	<?php 
include "header.php";
?>
    <script type="text/javascript">
	$(document).ready( function () {
	$('#AuditHistoryDetails').dataTable({
		"iDisplayLength": 20,
		"iDisplayStart": 20
		});			
	} );
   </script>
 </head>
 <body>
	<?php 
include "Menu.php";
?>
   <div class="positionDownload"><a href="AuditHistoryDownload.php?Afdate=<?php 
echo $Afrom;
Example #28
0
 public function executeStudentTransferDetail(sfWebRequest $request)
 {
     ## <SectionDetail>, <StudentDetail>, <GradedCourses> <CreateForm> <activatedRegrades> ## THESE ARE NEEDED STEP BY STEP
     $this->showToSectionForm = FALSE;
     $this->sectionIdNamePairArray = array();
     $this->departmentName = $this->getUser()->getAttribute('departmentName');
     $this->departmentId = $this->getUser()->getAttribute('departmentId');
     $this->programSectionId = $request->getParameter('sectionId');
     $this->studentId = $request->getParameter('studentId');
     $this->enrollmentId = $request->getParameter('enrollmentId');
     $this->sectionDetail = Doctrine_Core::getTable('ProgramSection')->findOneById($this->programSectionId);
     $this->forward404Unless($this->sectionDetail);
     $this->studentDetail = Doctrine_Core::getTable('Student')->getStudentDetailById($this->studentId);
     $this->forward404Unless($this->studentDetail);
     ## Prepare program section ID Name Pair
     if (Doctrine_Core::getTable('Department')->findOneById($this->departmentId)->checkIfActiveProgramSectionsExist($this->sectionDetail->getId(), $this->sectionDetail->getYear(), $this->sectionDetail->getSemester(), $this->sectionDetail->getAcademicYear())) {
         $this->showToSectionForm = TRUE;
         $this->sectionIdNamePairArray[''] = '--- Please Select New Section --- ';
         $this->departmentDetail = Doctrine_Core::getTable('Department')->findOneById($this->departmentId)->getWithActiveProgramSections($this->sectionDetail->getId(), $this->sectionDetail->getYear(), $this->sectionDetail->getSemester(), $this->sectionDetail->getAcademicYear());
         $this->forward404Unless($this->departmentDetail);
         foreach ($this->departmentDetail->getPrograms() as $p) {
             foreach ($p->getProgramSections() as $ps) {
                 $this->sectionIdNamePairArray[$ps->getId()] = 'Center ' . $ps->getCenter() . ' ' . $ps->getProgram() . ' Year: ' . $ps->getYear() . ' Semester: ' . $ps->getSemester() . ' A.Year: ' . $ps->getAcademicYear();
             }
         }
     }
     $this->transferForm = new FrontendTransferForm($this->studentDetail->getId(), $this->sectionDetail->getId(), $this->sectionIdNamePairArray);
     ### PROCESS THE FORM IF SUBMITTED ###
     if ($request->isMethod('post')) {
         $this->transferForm->bind($request->getParameter('transferform'));
         if ($this->transferForm->isValid()) {
             $formData = $this->transferForm->getValues();
             $fromSectionId = $formData['from_section_id'];
             $toSectionId = $formData['to_section_id'];
             $studentId = $formData['student_id'];
             if ($fromSectionId == '' || $toSectionId == '' || $studentId == '') {
                 $this->getUser()->setFlash('error', 'Error occured: nothing performed, please redo actions ');
                 $this->redirect('transfer/studentTransferDetail?sectionId=' . $this->programSectionId . '&studentId=' . $this->studentId . '&enrollmentId=' . $this->enrollmentId);
             }
             ##Do saving here!!
             #1. Find EnrollmentInfo and update it
             $enrollmentToUpdate = Doctrine_Core::getTable('EnrollmentInfo')->findOneById($this->enrollmentId)->updateCenterChange($toSectionId);
             #2. Add to Transfer
             //$studentTransfer = new StudentProgramSectionTransfer();
             $newSection = Doctrine_Core::getTable('ProgramSection')->findOneById($toSectionId);
             $toSection = $newSection->getCenter() . ' Center ' . $newSection->getProgram() . ' Year ' . $newSection->getYear() . ' Sememster' . $newSection->getSemester() . ' AC Year ' . $newSection->getAcademicYear();
             $newTransfer = new StudentProgramSectionTransfer();
             $newTransfer->addNewStudentProgramSectionTransfer($studentId, $fromSectionId, $toSection);
             ##Do Logging!!
             $newLog = new AuditLog();
             $action = "User has changed student Center to ";
             $action .= $newSection->getCenter() . ' Center ' . $newSection->getProgram() . ' Year ' . $newSection->getYear() . ' Sememster' . $newSection->getSemester() . ' AC Year ' . $newSection->getAcademicYear();
             $newLog->addNewLogInfo($this->getUser()->getAttribute('userId'), $action);
             $this->getUser()->setFlash('notice', 'Successfuly Transferred Student' . ' ' . $fromSectionId . ' ' . $toSectionId . ' ' . $studentId . ' ' . $this->enrollmentId);
             $this->redirect('transfer/sectiondetail?id=' . $this->programSectionId);
         }
     }
 }
Example #29
0
 public function processSectionCourseOffering(sfWebRequest $request, sfForm $courseChecklistForm)
 {
     $courseChecklistForm->bind($request->getParameter('courseChecklist'));
     if ($courseChecklistForm->isValid()) {
         ## get form values
         $formData = $this->courseChecklistForm->getValues();
         $courseIds = $formData['course_id'];
         if ($courseIds == NULL) {
             $this->getUser()->setFlash('error', 'Courses must be added to bucket');
             $this->redirect('sectioncourseoffering/index');
         }
         $section = $this->getUser()->getAttribute('sectionDetail');
         $numberOfAssignedCourses = SectionCourseOffering::assignCoursesToOneSection($courseIds, $section->getId());
         if ($numberOfAssignedCourses == 0) {
             $this->getUser()->setFlash('notice', 'Selected courses are already defined');
         } else {
             ##Do Logging!!
             $newLog = new AuditLog();
             $action = 'User has performed Course Offering for section ';
             $newLog->addNewLogInfo($this->getUser()->getAttribute('userId'), $action);
             $this->getUser()->setFlash('notice', $numberOfAssignedCourses . ' courses have been assigned to section');
             $this->redirect('sectioncourseoffering/index');
         }
     }
     $this->getUser()->setFlash('error', 'System error occured !');
     $this->redirect('sectioncourseoffering/index');
 }
Example #30
0
 public function executeApproveexemption(sfWebRequest $request)
 {
     #1. get requests
     $this->departmentName = $this->getUser()->getAttribute('departmentName');
     $this->programSectionId = $request->getParameter('sectionId');
     $this->studentId = $request->getParameter('studentId');
     $this->enrollmentId = $request->getParameter('enrollmentId');
     $this->studentNewCourseGradeId = $request->getParameter('studentCourseGradeId');
     $studentNewCourseGrade = Doctrine_Core::getTable('StudentCourseGrade')->findOneById($this->studentNewCourseGradeId);
     $studentNewCourseGrade->setIsCalculated(0);
     $studentNewCourseGrade->setIsExempted(1);
     $studentNewCourseGrade->save();
     ##Do Logging!!
     $newLog = new AuditLog();
     $action = 'Department Head has Approved Exemption Grade ';
     $newLog->addNewLogInfo($this->getUser()->getAttribute('userId'), $action);
     #Redirect to where it was
     $this->getUser()->setFlash('notice', 'Exemption Approval Was Successful');
     $this->redirect('exemption/studentExemptionDetail?sectionId=' . $this->programSectionId . '&studentId=' . $this->studentId . '&enrollmentId=' . $this->enrollmentId);
 }