예제 #1
0
 public function setAction()
 {
     $owner = $_POST['user'];
     $activities = $_POST['activities'];
     $object = $_POST['object'];
     $isValid = Website_P1GlobalFunction::checkValidation($_POST, array('user', 'activities', 'object'));
     if (count($isValid) > 0) {
         $arrayReturn = array("status" => "failed", "message" => "field not found", "data" => $isValid);
         $json_plans = $this->_helper->json($arrayReturn);
         Website_P1GlobalFunction::sendResponse($json_plans);
         exit;
     }
     $ownerId = Object_Abstract::getById($owner);
     $activitiesId = Object_Abstract::getById($activities);
     $key = str_replace(' ', '_', strtolower($ownerId->Name)) . "-" . str_replace(' ', '_', strtolower($activitiesId->Name) . "-" . rand());
     $now = date("Y-m-d,H-i");
     $getDateTime = new Pimcore_Date($now);
     if ($ownerId->o_className == "Customer") {
         $getId = Object_Abstract::getByPath('/log/customers');
         //get folder id
         $setLog = new Object\LogCustomers();
         $setLog->setCustomers($ownerId);
         $setLog->setActivities($activitiesId);
         $setLog->setObjectContent($object);
         $setLog->setDatetime($getDateTime);
         $setLog->setO_parentId($getId->o_id);
         $setLog->setKey($key);
         $setLog->setPublished(1);
         $setLog->save();
         $status = "Success";
         $message = "Success";
         $data = "Add Customer log Success";
     } else {
         if ($ownerId->o_className == "Agen") {
             $getId = Object_Abstract::getByPath('/log/agen');
             //get folder id
             $setLog = new Object\LogAgents();
             $setLog->setAgen($ownerId);
             $setLog->setActivities($activitiesId);
             $setLog->setObjectContent($object);
             $setLog->setDatetime($getDateTime);
             $setLog->setO_parentId($getId->o_id);
             $setLog->setKey($key);
             $setLog->setPublished(1);
             $setLog->save();
             $status = "Success";
             $message = "Success";
             $data = "Add Agen log Success";
         } else {
             $status = "Field";
             $message = "Log id not found";
             $data = "Null";
         }
     }
     $arrayReturn = array("status" => $status, "message" => $message, "data" => $data);
     $json_log = $this->_helper->json($arrayReturn);
     Website_P1GlobalFunction::sendResponse($json_log);
 }
예제 #2
0
 public static function setLog()
 {
     $ownerId = Object_Abstract::getById($owner);
     $activitiesId = Object_Abstract::getById($activities);
     $key = str_replace(' ', '_', strtolower($ownerId->name)) . "-" . str_replace(' ', '_', strtolower($activitiesId->name) . "-" . rand());
     $now = date("Y-m-d,H-i");
     $getDateTime = new Pimcore_Date($now);
     if ($ownerId->o_className == "Customer") {
         $getId = Object_Abstract::getByPath('/log/customers');
         //get folder id
         $setLog = new Object\LogCustomers();
         $setLog->setCustomers($ownerId);
         $setLog->setActivities($activitiesId);
         $setLog->setObjectContent($object);
         $setLog->setDatetime($getDateTime);
         $setLog->setO_parentId($getId->o_id);
         $setLog->setKey($key);
         $setLog->setPublished(1);
         $setLog->save();
     } else {
         if ($ownerId->o_className == "Agen") {
             $getId = Object_Abstract::getByPath('/log/agen');
             //get folder id
             $setLog = new Object\LogAgents();
             $setLog->setAgen($ownerId);
             $setLog->setActivities($activitiesId);
             $setLog->setObjectContent($object);
             $setLog->setDatetime($getDateTime);
             $setLog->setO_parentId($getId->o_id);
             $setLog->setKey($key);
             $setLog->setPublished(1);
             $setLog->save();
         } else {
             echo "ERROR";
         }
     }
 }