Inheritance: extends Pimcore\Model\AbstractModel
Exemplo n.º 1
0
 /**
  * Loads a list of document-types for the specicifies parameters, returns an array of Document\DocType elements
  *
  * @return array
  */
 public function load()
 {
     $targetsData = $this->db->fetchCol("SELECT id FROM targeting_rules" . $this->getCondition() . $this->getOrder() . $this->getOffsetLimit(), $this->model->getConditionVariables());
     $targets = array();
     foreach ($targetsData as $targetData) {
         $targets[] = Model\Tool\Targeting\Rule::getById($targetData);
     }
     $this->model->setTargets($targets);
     return $targets;
 }
Exemplo n.º 2
0
 public function ruleSaveAction()
 {
     $data = \Zend_Json::decode($this->getParam("data"));
     $target = Targeting\Rule::getById($this->getParam("id"));
     $target->setValues($data["settings"]);
     $target->setConditions($data["conditions"]);
     $actions = new Targeting\Rule\Actions();
     $actions->setRedirectEnabled($data["actions"]["redirect.enabled"]);
     $actions->setRedirectUrl($data["actions"]["redirect.url"]);
     $actions->setRedirectCode($data["actions"]["redirect.code"]);
     $actions->setEventEnabled($data["actions"]["event.enabled"]);
     $actions->setEventKey($data["actions"]["event.key"]);
     $actions->setEventValue($data["actions"]["event.value"]);
     $actions->setProgrammaticallyEnabled($data["actions"]["programmatically.enabled"]);
     $actions->setCodesnippetEnabled($data["actions"]["codesnippet.enabled"]);
     $actions->setCodesnippetCode($data["actions"]["codesnippet.code"]);
     $actions->setCodesnippetSelector($data["actions"]["codesnippet.selector"]);
     $actions->setCodesnippetPosition($data["actions"]["codesnippet.position"]);
     $actions->setPersonaId($data["actions"]["persona.id"]);
     $actions->setPersonaEnabled($data["actions"]["persona.enabled"]);
     $target->setActions($actions);
     $target->save();
     $this->_helper->json(["success" => true]);
 }