public function getdatafromajaxcallAction() { $taskallocation_model = new Default_Model_Tasksallocation(); $methodKey = $this->_getParam('methodKey', null); if ($methodKey == "1") { //Get Project Tasks $projectid = $this->_getParam('projectid', null); $options_data = ""; $options_data .= sapp_Global::selectOptionBuilder('0', 'Select Task'); if ($projectid != '') { $dept_data = $taskallocation_model->getProjectTasks($projectid); foreach ($dept_data as $dept) { $options_data .= sapp_Global::selectOptionBuilder($dept['id'], $dept['name']); } } $this->_helper->json(array('options' => $options_data)); } else { if ($methodKey == "2") { //Get Tasks Planned Activities $taskid = $this->_getParam('taskid', null); $this->_helper->json(array('options' => sapp_Global::_convertArrayToHTMLTable("leavecardtablegrid", "Task Details", $taskallocation_model->getTaskDetails($taskid)))); } else { if ($methodKey == "3") { //Get Tasks Planned Activities $taskid = $this->_getParam('taskid', null); $taskActivityDetails = $taskallocation_model->getTaskActivityDetails($taskid); $this->_helper->json(array('options' => $this->getActivitesEditableGrid($taskActivityDetails))); //$this->_helper->json(array('options' => sapp_Global::_convertArrayToHTMLTable("leavecardtablegrid", "Task Activity Details", $taskActivityDetails))); } else { if ($methodKey == "4") { //Get Project resources $projectid = $this->_getParam('projectid', null); $options_data = ""; //$options_data .= sapp_Global::selectOptionBuilder('0', 'Select Task'); if ($projectid != '') { $dept_data = $taskallocation_model->getEmployeesByProject($projectid); foreach ($dept_data as $dept) { $options_data .= sapp_Global::selectOptionBuilder($dept['id'], $dept['name']); } } $this->_helper->json(array('options' => $options_data)); } } } } }
public function editAction() { $auth = Zend_Auth::getInstance(); if ($auth->hasIdentity()) { $sess_vals = $auth->getStorage()->read(); $loginUserId = $auth->getStorage()->read()->id; $loginuserRole = $auth->getStorage()->read()->emprole; $loginuserGroup = $auth->getStorage()->read()->group_id; } $messages['message'] = ''; $id = $this->getRequest()->getParam('id', null); $taskModel = new Default_Model_Createtasks(); $currprojectsModel = new Default_Model_Createprojects(); $activityModel = new Default_Model_Createactivities(); $requi_model = new Default_Model_Requisition(); $usersModel = new Default_Model_Users(); $currentUserSummary = $usersModel->getEmployeeSummaryByID($loginUserId); $taskAllocationModel = new Default_Model_Tasksallocation(); $where = ""; $actionflag = 1; $form = new Default_Form_createprojects(); $form->setAttrib('action', DOMAIN . 'createtasks/edit/id/' . $id); //$this->view->activeprojects = $taskModel->getActiveProjects(); $this->view->activeprojects = $taskAllocationModel->getActiveProjectsForTasksForUser($currentUserSummary['businessunit_id'], $loginUserId, $loginuserGroup); $this->view->projectCategories = $taskModel->getProjectCategories(); $this->view->business_units_list = $requi_model->getBusinessUnits(); $this->view->allusers = array(); //$this->view->allusers = $usersModel->getAllActiveUsers(); try { if ($id > 0 && is_numeric($id)) { //update code $where = ""; $actionflag = 2; $id = abs($id); $taskdata = $taskModel->getTaskDataByID($id); $Currprojectdata = $currprojectsModel->getProjectDataByID($taskdata['projectid']); $form->submit->setLabel('Update Task'); $this->view->taskpagerefresh = '0'; $this->view->TaskID = $id; $this->view->loginuserGroup = $loginuserGroup; $this->view->form = $form; $this->view->isEdit = "1"; $this->view->data = $taskdata; $this->view->BUUsers = $usersModel->getAllActiveUsersByBU($Currprojectdata['businessunit']); $this->view->TrackingCodes = $currprojectsModel->getTrackingCodesByCategory($Currprojectdata['category']); if ($this->getRequest()->getPost()) { $trDb = Zend_Db_Table::getDefaultAdapter(); // starting transaction $trDb->beginTransaction(); try { $bFlag = true; //Task Details $tprojectSelected = $this->_getParam('projectSelected', null); $ttaskName = $this->_getParam('taskName', null); $ttaskDescription = $this->_getParam('taskDescription', null); $ttaskStartDate = $this->_getParam('taskStartDate', null); $ttaskEndDate = $this->_getParam('taskEndDate', null); $ttaskStatus = $this->_getParam('taskStatus', null); $ttaskPrimaryLead = $this->_getParam('taskPrimaryLead', null); $ttaskSecondaryLead = $this->_getParam('taskSecondaryLead', null); $ttaskEffort = $this->_getParam('taskEffort', null); //Task Activity Details $tprjactivitytaskid = $this->_getParam('prjactivitytaskid', null); $tprjactivityid = $this->_getParam('prjactivityid', null); $tprjactivitysdate = $this->_getParam('prjactivitysdate', null); $tprjactivityedate = $this->_getParam('prjactivityedate', null); $tprjactivityeffort = $this->_getParam('prjactivityeffort', null); $tprojectStartDate1 = sapp_Global::change_date(trim($ttaskStartDate), 'database'); $tprojectEndDate1 = sapp_Global::change_date(trim($ttaskEndDate), 'database'); $tprojectStartDate2 = sapp_Global::change_date(trim($taskdata['startdate']), 'database'); $tprojectEndDate2 = sapp_Global::change_date(trim($taskdata['enddate']), 'database'); //get tracking codes for edits $ttrackingcodestartdate = $this->_getParam('trackingcodestartdate', null); $ttrackingcodeenddate = $this->_getParam('trackingcodeenddate', null); $ttrackingcodeeffort = $this->_getParam('trackingcodeenddate', null); $mtaskactivitytrackingdata = array('startdate' => implode(',', $ttrackingcodestartdate), 'enddate' => implode(',', $ttrackingcodeenddate), 'effort' => implode(',', $ttrackingcodeeffort)); $this->view->taskactivitytrackingdata = $mtaskactivitytrackingdata; $this->view->taskpagerefresh = '1'; if ($tprojectStartDate2 != $tprojectStartDate1 && ($ttrackingcodestartdate <= 0 || $ttrackingcodestartdate == '')) { //$this->_helper->getHelper("FlashMessenger")->addMessage(array("error" => "Tracking code due to change in Project Planned Start Date.")); $validationMsg['message'] = 'Tracking code due to change in Task Planned Start Date.'; $validationMsg['msgtype'] = 'error'; $this->view->validationMsg = $validationMsg; $bFlag = false; } else { if ($tprojectEndDate2 != $tprojectEndDate1 && ($ttrackingcodeenddate <= 0 || $ttrackingcodeenddate == '')) { //$this->_helper->getHelper("FlashMessenger")->addMessage(array("error" => "Tracking code due to change in Project Planned End Date.")); $validationMsg['message'] = 'Tracking code due to change in Task Planned End Date.'; $validationMsg['msgtype'] = 'error'; $this->view->validationMsg = $validationMsg; $bFlag = false; } else { if ($taskdata['effort'] != $ttaskEffort && ($ttrackingcodeeffort <= 0 || $ttrackingcodeeffort == '')) { //$this->_helper->getHelper("FlashMessenger")->addMessage(array("error" => "Tracking code due to change in Project Planned Effort.")); $validationMsg['message'] = 'Tracking code due to change in Task Planned Effort.'; $validationMsg['msgtype'] = 'error'; $this->view->validationMsg = $validationMsg; $bFlag = false; } else { if ($tprojectSelected <= 0) { $validationMsg['message'] = 'Please select project.'; $validationMsg['msgtype'] = 'error'; $this->view->validationMsg = $validationMsg; $bFlag = false; } else { if (strlen(trim($ttaskName)) <= 0) { $validationMsg['message'] = 'Task name cannot be empty.'; $validationMsg['msgtype'] = 'error'; $this->view->validationMsg = $validationMsg; $bFlag = false; } else { if (strlen(trim($ttaskDescription)) <= 0) { $validationMsg['message'] = 'Task description cannot be empty.'; $validationMsg['msgtype'] = 'error'; $this->view->validationMsg = $validationMsg; $bFlag = false; } else { if (strlen(trim($ttaskStartDate)) <= 0) { $validationMsg['message'] = 'Task startdate cannot be empty.'; $validationMsg['msgtype'] = 'error'; $this->view->validationMsg = $validationMsg; $bFlag = false; } else { if (strlen(trim($ttaskEndDate)) <= 0) { $validationMsg['message'] = 'Task enddate cannot be empty.'; $validationMsg['msgtype'] = 'error'; $this->view->validationMsg = $validationMsg; $bFlag = false; } else { if (strlen(trim($ttaskEffort)) <= 0) { $validationMsg['message'] = 'Task effort cannot be empty.'; $validationMsg['msgtype'] = 'error'; $this->view->validationMsg = $validationMsg; $bFlag = false; } else { if ($ttaskPrimaryLead <= 0) { $validationMsg['message'] = 'Please select primary lead.'; $validationMsg['msgtype'] = 'error'; $this->view->validationMsg = $validationMsg; $bFlag = false; } else { if ($ttaskSecondaryLead <= 0) { $validationMsg['message'] = 'Please select secondary lead.'; $validationMsg['msgtype'] = 'error'; $this->view->validationMsg = $validationMsg; $bFlag = false; } } } } } } } } } } } if ($bFlag) { $mpolicydata = array('projectid' => trim($tprojectSelected), 'taskname' => trim($ttaskName), 'description' => trim($ttaskDescription), 'status' => trim($ttaskStatus), 'effort' => trim($ttaskEffort), 'startdate' => sapp_Global::change_date(trim($ttaskStartDate), 'database'), 'enddate' => sapp_Global::change_date(trim($ttaskEndDate), 'database'), 'primarylead' => trim($ttaskPrimaryLead), 'secondarylead' => trim($ttaskSecondaryLead), 'modifiedby' => trim($loginUserId), 'modifieddate' => gmdate("Y-m-d H:i:s")); $where = array('id=?' => $id); $Id = $taskModel->SaveorUpdateData($mpolicydata, $where); if ($tprojectStartDate2 != $tprojectStartDate1 || $tprojectEndDate2 != $tprojectEndDate1 || $taskdata['effort'] != $ttaskEffort) { $taskslogModel = new Default_Model_Createtaskslog(); $mprojectlogdata = array('taskid' => trim($taskdata['id']), 'startdatetrackingcodeid' => trim($ttrackingcodestartdate), 'enddatetrackingcodeid' => trim($ttrackingcodeenddate), 'efforttrackingcodeid' => trim($ttrackingcodeeffort), 'effortold' => trim($taskdata['effort']), 'startdateold' => $tprojectStartDate2, 'enddateold' => $tprojectEndDate2, 'effortnew' => $ttaskEffort, 'startdatenew' => $tprojectStartDate1, 'enddatenew' => $tprojectEndDate1, 'createdby' => trim($loginUserId), 'createddate' => gmdate("Y-m-d H:i:s")); $where = ""; $Id = $taskslogModel->SaveorUpdateData($mprojectlogdata, $where); } //update Task Activities $currRow = 0; foreach ($tprjactivityid as $tprjactid) { $mactivitydata = array('effort' => trim($tprjactivityeffort[$currRow]), 'startdate' => sapp_Global::change_date(trim($tprjactivitysdate[$currRow]), 'database'), 'enddate' => sapp_Global::change_date(trim($tprjactivityedate[$currRow]), 'database'), 'modifiedby' => trim($loginUserId), 'modifieddate' => gmdate("Y-m-d H:i:s")); $where = array('id=?' => $tprjactivitytaskid[$currRow]); $Id1 = $activityModel->SaveorUpdateData($mactivitydata, $where); $currRow = $currRow + 1; } $menuID = -999; sapp_Global::logManager($menuID, $actionflag, $loginUserId, $id); $this->_helper->getHelper("FlashMessenger")->addMessage(array("success" => "Task details successfully modified.")); $trDb->commit(); $this->_redirect('/createtasks'); } } catch (Exception $e) { $trDb->rollBack(); $this->_helper->getHelper("FlashMessenger")->addMessage(array("success" => "Something went wrong, please try again later.")); $this->_redirect('/createtasks'); } } } else { //Insert code $actionflag = 1; if ($this->getRequest()->getPost()) { #$result = $this->save($form, $policydata); $trDb = Zend_Db_Table::getDefaultAdapter(); // starting transaction $trDb->beginTransaction(); try { $bFlag = true; //Task Details $tprojectSelected = $this->_getParam('projectSelected', null); $ttaskName = $this->_getParam('taskName', null); $ttaskDescription = $this->_getParam('taskDescription', null); $ttaskStartDate = $this->_getParam('taskStartDate', null); $ttaskEndDate = $this->_getParam('taskEndDate', null); $ttaskStatus = $this->_getParam('taskStatus', null); $ttaskPrimaryLead = $this->_getParam('taskPrimaryLead', null); $ttaskSecondaryLead = $this->_getParam('taskSecondaryLead', null); $ttaskEffort = $this->_getParam('taskEffort', null); //Task Activity Details $tprjactivityid = $this->_getParam('prjactivityid', null); $tprjactivitysdate = $this->_getParam('prjactivitysdate', null); $tprjactivityedate = $this->_getParam('prjactivityedate', null); $tprjactivityeffort = $this->_getParam('prjactivityeffort', null); $tprjactivitysdate1 = implode(',', $tprjactivitysdate); $mtaskactivitytrackingdata = array('startdate' => implode(',', $tprjactivitysdate), 'enddate' => implode(',', $tprjactivityedate), 'effort' => implode(',', $tprjactivityeffort)); $this->view->taskactivitytrackingdata = $mtaskactivitytrackingdata; $this->view->taskpagerefresh = '1'; if ($tprojectSelected <= 0) { $validationMsg['message'] = 'Please select project.'; $validationMsg['msgtype'] = 'error'; $this->view->validationMsg = $validationMsg; $bFlag = false; } else { if (strlen(trim($ttaskName)) <= 0) { $validationMsg['message'] = 'Task name cannot be empty.'; $validationMsg['msgtype'] = 'error'; $this->view->validationMsg = $validationMsg; $bFlag = false; } else { if (strlen(trim($ttaskDescription)) <= 0) { $validationMsg['message'] = 'Task description cannot be empty.'; $validationMsg['msgtype'] = 'error'; $this->view->validationMsg = $validationMsg; $bFlag = false; } else { if (strlen(trim($ttaskStartDate)) <= 0) { $validationMsg['message'] = 'Task startdate cannot be empty.'; $validationMsg['msgtype'] = 'error'; $this->view->validationMsg = $validationMsg; $bFlag = false; } else { if (strlen(trim($ttaskEndDate)) <= 0) { $validationMsg['message'] = 'Task enddate cannot be empty.'; $validationMsg['msgtype'] = 'error'; $this->view->validationMsg = $validationMsg; $bFlag = false; } else { if (strlen(trim($ttaskEffort)) <= 0) { $validationMsg['message'] = 'Task effort cannot be empty.'; $validationMsg['msgtype'] = 'error'; $this->view->validationMsg = $validationMsg; $bFlag = false; } else { if ($ttaskPrimaryLead <= 0) { $validationMsg['message'] = 'Please select primary lead.'; $validationMsg['msgtype'] = 'error'; $this->view->validationMsg = $validationMsg; $bFlag = false; } else { if ($ttaskSecondaryLead <= 0) { $validationMsg['message'] = 'Please select secondary lead.'; $validationMsg['msgtype'] = 'error'; $this->view->validationMsg = $validationMsg; $bFlag = false; } } } } } } } } $mpolicydata = array('projectid' => trim($tprojectSelected), 'taskname' => trim($ttaskName), 'description' => trim($ttaskDescription), 'status' => trim($ttaskStatus), 'effort' => trim($ttaskEffort), 'startdate' => sapp_Global::change_date(trim($ttaskStartDate), 'database'), 'enddate' => sapp_Global::change_date(trim($ttaskEndDate), 'database'), 'primarylead' => trim($ttaskPrimaryLead), 'secondarylead' => trim($ttaskSecondaryLead), 'createdby' => trim($loginUserId), 'createddate' => gmdate("Y-m-d H:i:s"), 'modifiedby' => trim($loginUserId), 'modifieddate' => gmdate("Y-m-d H:i:s")); if ($bFlag) { $Id = $taskModel->SaveorUpdateData($mpolicydata, $where); if ($Id > 0 && is_numeric($Id)) { //Insert Task Activities $currRow = 0; foreach ($tprjactivityid as $tprjactid) { $mactivitydata = array('taskid' => trim($Id), 'activityid' => trim($tprjactid), 'status' => trim($ttaskStatus), 'effort' => trim($tprjactivityeffort[$currRow]), 'startdate' => sapp_Global::change_date(trim($tprjactivitysdate[$currRow]), 'database'), 'enddate' => sapp_Global::change_date(trim($tprjactivityedate[$currRow]), 'database'), 'primarylead' => trim($ttaskPrimaryLead), 'secondarylead' => trim($ttaskSecondaryLead), 'createdby' => trim($loginUserId), 'createddate' => gmdate("Y-m-d H:i:s"), 'modifiedby' => trim($loginUserId), 'modifieddate' => gmdate("Y-m-d H:i:s")); $currRow = $currRow + 1; $Id1 = $activityModel->SaveorUpdateData($mactivitydata, $where); } $menuID = -999; sapp_Global::logManager($menuID, $actionflag, $loginUserId, $id); $this->_helper->getHelper("FlashMessenger")->addMessage(array("success" => "Project details successfully added.")); } else { $this->_helper->getHelper("FlashMessenger")->addMessage(array("error" => "Error while adding project details.")); } $trDb->commit(); $this->_redirect('/createtasks'); } } catch (Exception $e) { $trDb->rollBack(); $this->_helper->getHelper("FlashMessenger")->addMessage(array("success" => "Something went wrong, please try again later.")); $this->_redirect('/createtasks'); } } if ($tprojectSelected > 0) { $Currprojectdata = $currprojectsModel->getProjectDataByID($tprojectSelected); $this->view->BUUsers = $usersModel->getAllActiveUsersByBU($Currprojectdata['businessunit']); } $form->submit->setLabel('Add Task'); $this->view->loginuserGroup = $loginuserGroup; $this->view->TaskID = "0"; $this->view->form = $form; $this->view->isEdit = "0"; $this->view->data = $mpolicydata; } } catch (Exception $e) { $this->view->nodata = 'nodata'; } }
public function editAction() { $auth = Zend_Auth::getInstance(); if ($auth->hasIdentity()) { $sess_vals = $auth->getStorage()->read(); $loginUserId = $auth->getStorage()->read()->id; $loginuserRole = $auth->getStorage()->read()->emprole; $loginuserGroup = $auth->getStorage()->read()->group_id; } $messages['message'] = ''; $id = $this->getRequest()->getParam('id', null); $taskAllocationModel = new Default_Model_Tasksallocation(); $activityModel = new Default_Model_Createactivities(); $requi_model = new Default_Model_Requisition(); $usersModel = new Default_Model_Users(); $currentUserSummary = $usersModel->getEmployeeSummaryByID($loginUserId); $where = ""; $actionflag = 1; $form = new Default_Form_createprojects(); $form->setAttrib('action', DOMAIN . 'tasksallocation/edit/id/' . $id); //$this->view->activeprojects = $taskAllocationModel->getActiveProjects(); $this->view->activeprojects = $taskAllocationModel->getActiveProjectsForUser($currentUserSummary['businessunit_id'], $loginUserId, $loginuserGroup); $this->view->projectCategories = $taskAllocationModel->getProjectCategories(); $this->view->business_units_list = $requi_model->getBusinessUnits(); $this->view->allusers = array(); //$this->view->allusers = $usersModel->getAllActiveUsers(); $form->submit->setLabel('Allocate Task Activities'); $this->view->loginuserGroup = $loginuserGroup; $this->view->form = $form; if ($this->getRequest()->getPost()) { $trDb = Zend_Db_Table::getDefaultAdapter(); // starting transaction $trDb->beginTransaction(); $tprojectSelected = $this->_getParam('projectSelected', null); $ttaskSelected = $this->_getParam('taskSelected', null); $ActivitiesForTasks = $taskAllocationModel->getTaskActivityDetails($ttaskSelected); $ttaskallocationdelete = $this->_getParam('taskallocationdelete', null); $ttaskallocationactivitys = $this->_getParam('taskallocationactivity', null); $ttaskallocationresource = $this->_getParam('taskallocationresource', null); $ttaskallocationstartdate = $this->_getParam('taskallocationstartdate', null); $ttaskallocationenddate = $this->_getParam('taskallocationenddate', null); $ttaskallocationeffort = $this->_getParam('taskallocationeffort', null); $ttaskallocationrowid = $this->_getParam('taskallocationrowid', null); $resCurPos = 0; foreach ($ttaskallocationactivitys as $ttaskallocationactivity) { $varCurrAction = "0"; $currRowID = $ttaskallocationrowid[$resCurPos]; $allocID = $this->getIDbyActivity($ActivitiesForTasks, $ttaskallocationactivity); if (is_numeric($currRowID)) { if ($currRowID > 0) { //for Update $mpolicydata = array('taskactivityid' => trim($allocID), 'resourceid' => trim($ttaskallocationresource[$resCurPos]), 'effort' => trim($ttaskallocationeffort[$resCurPos]), 'startdate' => sapp_Global::change_date(trim($ttaskallocationstartdate[$resCurPos]), 'database'), 'enddate' => sapp_Global::change_date(trim($ttaskallocationenddate[$resCurPos]), 'database'), 'modifiedby' => trim($loginUserId), 'modifieddate' => gmdate("Y-m-d H:i:s")); $where = array('id=?' => $currRowID); $varCurrAction = $taskAllocationModel->SaveorUpdateData($mpolicydata, $where); } } if ($varCurrAction == "0") { //for Insert $mpolicydata = array('taskactivityid' => trim($allocID), 'resourceid' => trim($ttaskallocationresource[$resCurPos]), 'status' => trim('5'), 'effort' => trim($ttaskallocationeffort[$resCurPos]), 'startdate' => sapp_Global::change_date(trim($ttaskallocationstartdate[$resCurPos]), 'database'), 'enddate' => sapp_Global::change_date(trim($ttaskallocationenddate[$resCurPos]), 'database'), 'createdby' => trim($loginUserId), 'createddate' => gmdate("Y-m-d H:i:s"), 'modifiedby' => trim($loginUserId), 'modifieddate' => gmdate("Y-m-d H:i:s")); $where = ""; $Id = $taskAllocationModel->SaveorUpdateData($mpolicydata, $where); } $resCurPos = $resCurPos + 1; } //for Soft Delete foreach ($ttaskallocationdelete as $ttaskallocationdelete1) { $isRecordForDelete = $ttaskallocationdelete[$resCurPos]; if (is_numeric($ttaskallocationdelete1)) { if ($ttaskallocationdelete1 > 0) { $mpolicydata = array('isactive' => '0', 'modifiedby' => trim($loginUserId), 'modifieddate' => gmdate("Y-m-d H:i:s")); $where = array('id=?' => $ttaskallocationdelete1); $varCurrAction = $taskAllocationModel->SaveorUpdateData($mpolicydata, $where); } } } $menuID = -999; sapp_Global::logManager($menuID, $actionflag, $loginUserId, $id); $this->_helper->getHelper("FlashMessenger")->addMessage(array("success" => "Task successfully allocated.")); $trDb->commit(); $this->_redirect('/tasksallocation'); } }
public function editAction() { $auth = Zend_Auth::getInstance(); if ($auth->hasIdentity()) { $sess_vals = $auth->getStorage()->read(); $loginUserId = $auth->getStorage()->read()->id; $loginuserRole = $auth->getStorage()->read()->emprole; $loginuserGroup = $auth->getStorage()->read()->group_id; } $messages['message'] = ''; $id = $this->getRequest()->getParam('id', null); $meetingRoom = new Default_Model_Meetingroom(); $taskModel = new Default_Model_Createtasks(); $currprojectsModel = new Default_Model_Createprojects(); $activityModel = new Default_Model_Createactivities(); $requi_model = new Default_Model_Requisition(); $usersModel = new Default_Model_Users(); $currentUserSummary = $usersModel->getEmployeeSummaryByID($loginUserId); $taskAllocationModel = new Default_Model_Tasksallocation(); $where = ""; $actionflag = 1; $form = new Default_Form_createprojects(); //$form = new Default_Form_createprojects(); $form->setAttrib('action', DOMAIN . 'meetingroomblock/edit/id/' . $id); $this->view->activeprojects = $taskModel->getActiveProjects(); $this->view->activeprojects = $taskAllocationModel->getActiveProjectsForTasksForUser($currentUserSummary['businessunit_id'], $loginUserId, $loginuserGroup); $this->view->projectCategories = $taskModel->getProjectCategories(); $this->view->business_units_list = $meetingRoom->getBusinessUnits(); $this->view->meetingrooms = $meetingRoom->getActiveMeetingRooms(); $this->view->allusers = array(); //$this->view->allusers = $usersModel->getAllActiveUsers(); try { if ($id > 0 && is_numeric($id)) { //update code $where = ""; $actionflag = 2; $id = abs($id); $meetingdata = $meetingRoom->getMeetingRoomDataByID($id); // $Currprojectdata = $currprojectsModel->getProjectDataByID($taskdata['projectid']); $form->submit->setLabel('Update Meeting'); $this->view->taskpagerefresh = '0'; $this->view->MeetingRoomID = $id; $this->view->loginuserGroup = $loginuserGroup; $this->view->form = $form; $this->view->isEdit = "1"; $this->view->data = $meetingdata; $this->view->delta_recipents_list = $meetingRoom->getRecipentsByBU($meetingdata['businessunit']); if ($this->getRequest()->getPost()) { $trDb = Zend_Db_Table::getDefaultAdapter(); // starting transaction $trDb->beginTransaction(); try { $bFlag = true; //Meeting Room Details $deltameetingrooms = $this->_getParam('deltameetingrooms', null); $meetingDate = $this->_getParam('meetingDate', null); $meetingStartTime = $this->_getParam('meetingStartTime', null); $meetingEndTime = $this->_getParam('meetingEndTime', null); $projectBU = $this->_getParam('projectBU', null); $buResources = $this->_getParam('buResources', null); $clientrecipients = $this->_getParam('clientrecipients', null); $meetingtitle = $this->_getParam('meetingtitle', null); $meetingnotes = $this->_getParam('meetingnotes', null); $deltaOwnerResource = $this->_getParam('deltaOwnerResource', null); $clientOwnerResource = $this->_getParam('clientOwnerResource', null); if ($deltameetingrooms <= 0) { $validationMsg['message'] = 'Please select meetingroom.'; $validationMsg['msgtype'] = 'error'; $this->view->validationMsg = $validationMsg; $bFlag = false; } else { if (strlen(trim($meetingDate)) <= 0) { $validationMsg['message'] = 'Meeting Date cannot be empty.'; $validationMsg['msgtype'] = 'error'; $this->view->validationMsg = $validationMsg; $bFlag = false; } else { if (strlen(trim($meetingStartTime)) <= 0) { $validationMsg['message'] = 'Meeting Start Time cannot be empty.'; $validationMsg['msgtype'] = 'error'; $this->view->validationMsg = $validationMsg; $bFlag = false; } else { if (strlen(trim($meetingEndTime)) <= 0) { $validationMsg['message'] = 'Meeting End Time cannot be empty.'; $validationMsg['msgtype'] = 'error'; $this->view->validationMsg = $validationMsg; $bFlag = false; } else { if (count($projectBU) <= 0) { $validationMsg['message'] = 'Please select Business Unit.'; $validationMsg['msgtype'] = 'error'; $this->view->validationMsg = $validationMsg; $bFlag = false; } else { if (count($buResources) <= 0) { $validationMsg['message'] = 'Please select Recipients.'; $validationMsg['msgtype'] = 'error'; $this->view->validationMsg = $validationMsg; $bFlag = false; } else { if (strlen(trim($meetingtitle)) <= 0) { $validationMsg['message'] = 'Title cannot be empty.'; $validationMsg['msgtype'] = 'error'; $this->view->validationMsg = $validationMsg; $bFlag = false; } else { if (strlen(trim($meetingnotes)) <= 0) { $validationMsg['message'] = 'Description cannot be empty.'; $validationMsg['msgtype'] = 'error'; $this->view->validationMsg = $validationMsg; $bFlag = false; } else { if ($deltaOwnerResource <= 0) { $validationMsg['message'] = 'Please select Delta Owner.'; $validationMsg['msgtype'] = 'error'; $this->view->validationMsg = $validationMsg; $bFlag = false; } } } } } } } } } if ($bFlag) { $mpolicydata = array('roomid' => trim($deltameetingrooms), 'blockmeetingdate' => trim($meetingDate), 'blockmeetingstarttime' => sapp_Global::change_time(trim($meetingStartTime) . 'database'), 'blockmeetingendtime' => sapp_Global::change_time(trim($meetingEndTime), 'database'), 'businessunit' => implode(',', $projectBU), 'createdby' => trim($loginUserId), 'title' => trim($meetingtitle), 'clientrecipients' => trim($clientrecipients), 'deltarecipients' => implode(',', $buResources), 'createddate' => gmdate("Y-m-d H:i:s"), 'description' => trim($meetingnotes), 'deltaowner' => trim($deltaOwnerResource), 'clientowner' => trim($clientOwnerResource), 'modifiedby' => trim($loginUserId), 'modifieddate' => gmdate("Y-m-d H:i:s")); $where = array('id = ?' => $id); $Id = $meetingRoom->SaveorUpdateData($mpolicydata, $where); $this->sendInvite(implode(',', $buResources), $loginUserId, trim($meetingDate), trim($meetingStartTime), trim($meetingEndTime), $id, $meetingnotes, $meetingtitle); $menuID = 99; sapp_Global::logManager($menuID, $actionflag, $loginUserId, $id); $this->_helper->getHelper("FlashMessenger")->addMessage(array("success" => "Project details successfully updated.")); /* } else { $this->_helper->getHelper("FlashMessenger")->addMessage(array("error" => "Error while updating project details.")); } */ $trDb->commit(); $this->_redirect('/meetingroomblock'); } } catch (Exception $e) { $trDb->rollBack(); $this->_helper->getHelper("FlashMessenger")->addMessage(array("success" => "Something went wrong, please try again later.")); $this->_redirect('/meetingroomblock'); } } } else { //Insert code $actionflag = 1; if ($this->getRequest()->getPost()) { #$result = $this->save($form, $policydata); $trDb = Zend_Db_Table::getDefaultAdapter(); // starting transaction $trDb->beginTransaction(); try { $bFlag = true; //Meeting Room Details $deltameetingrooms = $this->_getParam('deltameetingrooms', null); $meetingDate = $this->_getParam('meetingDate', null); $meetingStartTime = $this->_getParam('meetingStartTime', null); $meetingEndTime = $this->_getParam('meetingEndTime', null); $projectBU = $this->_getParam('projectBU', null); $buResources = $this->_getParam('buResources', null); $clientrecipients = $this->_getParam('clientrecipients', null); $meetingtitle = $this->_getParam('meetingtitle', null); $meetingnotes = $this->_getParam('meetingnotes', null); $deltaOwnerResource = $this->_getParam('deltaOwnerResource', null); $clientOwnerResource = $this->_getParam('clientOwnerResource', null); if ($deltameetingrooms <= 0) { $validationMsg['message'] = 'Please select meetingroom.'; $validationMsg['msgtype'] = 'error'; $this->view->validationMsg = $validationMsg; $bFlag = false; } else { if (strlen(trim($meetingDate)) <= 0) { $validationMsg['message'] = 'Meeting Date cannot be empty.'; $validationMsg['msgtype'] = 'error'; $this->view->validationMsg = $validationMsg; $bFlag = false; } else { if (strlen(trim($meetingStartTime)) <= 0) { $validationMsg['message'] = 'Meeting Start Time cannot be empty.'; $validationMsg['msgtype'] = 'error'; $this->view->validationMsg = $validationMsg; $bFlag = false; } else { if (strlen(trim($meetingEndTime)) <= 0) { $validationMsg['message'] = 'Meeting End Time cannot be empty.'; $validationMsg['msgtype'] = 'error'; $this->view->validationMsg = $validationMsg; $bFlag = false; } else { if (count($projectBU) <= 0) { $validationMsg['message'] = 'Please select Business Unit.'; $validationMsg['msgtype'] = 'error'; $this->view->validationMsg = $validationMsg; $bFlag = false; } else { if (count($buResources) <= 0) { $validationMsg['message'] = 'Please select Recipients.'; $validationMsg['msgtype'] = 'error'; $this->view->validationMsg = $validationMsg; $bFlag = false; } else { if (strlen(trim($meetingtitle)) <= 0) { $validationMsg['message'] = 'Title cannot be empty.'; $validationMsg['msgtype'] = 'error'; $this->view->validationMsg = $validationMsg; $bFlag = false; } else { if (strlen(trim($meetingnotes)) <= 0) { $validationMsg['message'] = 'Description cannot be empty.'; $validationMsg['msgtype'] = 'error'; $this->view->validationMsg = $validationMsg; $bFlag = false; } else { if ($deltaOwnerResource <= 0) { $validationMsg['message'] = 'Please select Delta Owner.'; $validationMsg['msgtype'] = 'error'; $this->view->validationMsg = $validationMsg; $bFlag = false; } } } } } } } } } $mpolicydata = array('roomid' => trim($deltameetingrooms), 'blockmeetingdate' => trim($meetingDate), 'blockmeetingstarttime' => sapp_Global::change_time(trim($meetingStartTime), 'database'), 'blockmeetingendtime' => sapp_Global::change_time(trim($meetingEndTime), 'database'), 'businessunit' => implode(',', $projectBU), 'createdby' => trim($loginUserId), 'title' => trim($meetingtitle), 'clientrecipients' => trim($clientrecipients), 'deltarecipients' => implode(',', $buResources), 'createddate' => gmdate("Y-m-d H:i:s"), 'description' => trim($meetingnotes), 'deltaowner' => trim($deltaOwnerResource), 'clientowner' => trim($clientOwnerResource), 'modifiedby' => trim($loginUserId), 'modifieddate' => gmdate("Y-m-d H:i:s")); if ($bFlag) { $Id = $meetingRoom->SaveorUpdateData($mpolicydata, $where); $this->sendInvite(implode(',', $buResources), $loginUserId, trim($meetingDate), trim($meetingStartTime), trim($meetingEndTime), $Id, $meetingnotes, $meetingtitle); $menuID = 99; sapp_Global::logManager($menuID, $actionflag, $loginUserId, $id); $this->_helper->getHelper("FlashMessenger")->addMessage(array("success" => "Project details successfully added.")); } else { $this->_helper->getHelper("FlashMessenger")->addMessage(array("error" => "Error while adding project details.")); } $trDb->commit(); $this->_redirect('/meetingroomblock'); } catch (Exception $e) { $trDb->rollBack(); $this->_helper->getHelper("FlashMessenger")->addMessage(array("success" => "Something went wrong, please try again later.")); $this->_redirect('/meetingroomblock'); } } if ($tprojectSelected > 0) { $Currprojectdata = $currprojectsModel->getProjectDataByID($tprojectSelected); $this->view->BUUsers = $usersModel->getAllActiveUsersByBU($Currprojectdata['businessunit']); } $form->submit->setLabel('Add Task'); $this->view->loginuserGroup = $loginuserGroup; $this->view->TaskID = "0"; $this->view->form = $form; $this->view->isEdit = "0"; $this->view->data = $mpolicydata; } } catch (Exception $e) { $this->view->nodata = 'nodata'; } }