Пример #1
0
 /**
  * Validate the location proposition of the resource (proposedFor attribute).
  *
  * @return void
  * @access public
  */
 function validateProposedLocation()
 {
     if ($this->_status->setLocation($this->_status->getProposedFor()) && $this->_status->setProposedFor(0)) {
         $this->validateEdition(RESOURCE_EDITION_LOCATION);
     }
 }
Пример #2
0
 /**
  * Constructor.
  *
  * @return void
  * @access public
  */
 function __construct($id = 0, $user = false)
 {
     // Loads up CMS_log with Id from database or with DB array
     if ($id) {
         if (SensitiveIO::isPositiveInteger($id)) {
             $sql = "\n\t\t\t\t\tselect\n\t\t\t\t\t\t*\n\t\t\t\t\tfrom\n\t\t\t\t\t\tlog\n\t\t\t\t\twhere\n\t\t\t\t\t\tid_log='" . $id . "'\n\t\t\t\t";
             $q = new CMS_query($sql);
             if ($q->getNumRows()) {
                 $this->_id = $id;
                 $data = $q->getArray();
             } else {
                 $this->raiseError("Unknown DB ID : " . $id);
                 return;
             }
         } elseif (is_array($id)) {
             $data = $id;
             $this->_id = $data['id_log'];
         } else {
             $this->raiseError("Id is not a positive integer nor array");
             return;
         }
         if (is_array($data) && $data) {
             if ($user === false) {
                 $this->_user = new CMS_profile_user($data["user_log"]);
             } else {
                 $this->_user = $user;
             }
             $this->_action = $data["action_log"];
             $date = new CMS_date();
             $date->setFromDBValue($data["datetime_log"]);
             $this->_datetime = $date;
             $this->_textData = $data["textData_log"];
             $this->_label = $data["label_log"];
             $this->_module = $data["module_log"];
             $this->_resource = $data["resource_log"];
             // Create resource objects and populate
             $this->_resourceStatusAfter = new CMS_resourceStatus();
             $this->_resourceStatusAfter->setDebug(false);
             $this->_resourceStatusAfter->setLog(false);
             $this->_resourceStatusAfter->setLocation($data["rsAfterLocation_log"]);
             $this->_resourceStatusAfter->setProposedFor($data["rsAfterProposedFor_log"]);
             $this->_resourceStatusAfter->setAllEditions($data["rsAfterEditions_log"]);
             $this->_resourceStatusAfter->setAllValidationsRefused($data["rsAfterValidationsRefused_log"]);
             $this->_resourceStatusAfter->setPublication($data["rsAfterPublication_log"]);
             //specific draft status
             if ($this->_action == CMS_log::LOG_ACTION_RESOURCE_EDIT_DRAFT) {
                 $this->_resourceStatusAfter->setDraft(true);
             }
         }
     } else {
         $this->_user = new CMS_profile_user();
         $this->_resourceStatusAfter = new CMS_resourceStatus();
         $this->_datetime = new CMS_date();
     }
 }