コード例 #1
0
ファイル: Dao.php プロジェクト: jansarmir/pimcore
 /**
  * Loads a list of predefined properties for the specicifies parameters, returns an array of Property\Predefined elements
  *
  * @return array
  */
 public function load()
 {
     $properties = array();
     $propertiesData = $this->db->fetchAll($this->model->getFilter(), $this->model->getOrder());
     foreach ($propertiesData as $propertyData) {
         $properties[] = Config::getByName($propertyData["id"]);
     }
     $this->model->setCodes($properties);
     return $properties;
 }
コード例 #2
0
ファイル: QrcodeController.php プロジェクト: solverat/pimcore
 public function updateAction()
 {
     $code = Qrcode\Config::getByName($this->getParam("name"));
     $data = \Zend_Json::decode($this->getParam("configuration"));
     foreach ($data as $key => $value) {
         $setter = "set" . ucfirst($key);
         if (method_exists($code, $setter)) {
             $code->{$setter}($value);
         }
     }
     $code->save();
     $this->_helper->json(["success" => true]);
 }
コード例 #3
0
ファイル: QrCode.php プロジェクト: emanuel-london/pimcore
 /**
  * @param \Zend_Controller_Request_Abstract $request
  */
 public function routeStartup(\Zend_Controller_Request_Abstract $request)
 {
     if (preg_match("@^/qr~-~code/([a-zA-Z0-9_\\-]+)@", $request->getPathInfo(), $matches)) {
         if (array_key_exists(1, $matches) && !empty($matches[1])) {
             $code = Tool\Qrcode\Config::getByName($matches[1]);
             if ($code) {
                 $url = $code->getUrl();
                 if ($code->getGoogleAnalytics()) {
                     $glue = "?";
                     if (strpos($url, "?")) {
                         $glue = "&";
                     }
                     $url .= $glue;
                     $url .= "utm_source=Mobile&utm_medium=QR-Code&utm_campaign=" . $code->getName();
                 }
                 header("Location: " . $url, true, 302);
                 exit;
             } else {
                 \Logger::error("called an QR code but '" . $matches[1] . " is not a code in the system.");
             }
         }
     }
 }
コード例 #4
0
// create legacy config folder
$legacyFolder = PIMCORE_CONFIGURATION_DIRECTORY . "/LEGACY";
if (!is_dir($legacyFolder)) {
    mkdir($legacyFolder, 0777, true);
}
// QR-CODES
$dir = PIMCORE_CONFIGURATION_DIRECTORY . "/qrcodes";
if (is_dir($dir)) {
    $file = Pimcore\Config::locateConfigFile("qrcode.json");
    $json = \Pimcore\Db\JsonFileTable::get($file);
    $json->truncate();
    $files = scandir($dir);
    foreach ($files as $file) {
        if (strpos($file, ".xml")) {
            $name = str_replace(".xml", "", $file);
            $thumbnail = \Pimcore\Model\Tool\Qrcode\Config::getByName($name);
            $thumbnail = object2array($thumbnail);
            $thumbnail["id"] = $thumbnail["name"];
            unset($thumbnail["name"]);
            $json->insertOrUpdate($thumbnail, $thumbnail["id"]);
        }
    }
    // move data
    rename($dir, $legacyFolder . "/qrcodes");
}
// SQL REPORTS
$dir = PIMCORE_CONFIGURATION_DIRECTORY . "/sqlreport";
if (is_dir($dir)) {
    $file = Pimcore\Config::locateConfigFile("custom-reports.json");
    $json = \Pimcore\Db\JsonFileTable::get($file);
    $json->truncate();