コード例 #1
0
    /**
     * @return string
     */
    private function renderFormElement()
    {
        $path = '/' . $this->plugin->PIO()->PathGet() . '/';
        $cachetime = $this->plugin->getCachetime();
        if ($data = $this->plugin->cache->retrieve("plenigo-backend") && $cachetime > 0) {
            $products = $data['products'];
            $categories = $data['categories'];
        } else {
            $products = cl6Plugin_plenigo::getProducts();
            $categories = cl6Plugin_plenigo::getCategories();
            $this->plugin->cache->store("plenigo-backend", array('products' => $products, 'categories' => $categories), $cachetime);
        }
        $active = array('categoryID' => null, 'productID' => null);
        if (is_array($this->sContent) && isset($this->sContent['value'])) {
            $active['categoryID'] = $this->sContent['value'][0] ? $this->sContent['value'][0] : null;
            $active['productID'] = $this->sContent['value'][1] ? $this->sContent['value'][1] : null;
        }
        $catSelect = $this->renderSelect('categoryID', $categories, $active['categoryID']);
        $prodSelect = $this->renderSelect('productID', $products, $active['productID']);
        $html = <<<EOT

        <fieldset style="display: block; margin: 10px 0; position: relative; border: none; max-width: 500px;">
            <label style="min-width: 120px; display: inline-block;">plenigo-Kategorie:</label>
            {$catSelect}
            <br><br>
            <label style="min-width: 120px; display: inline-block;">plenigo-Produkt:</label>
            {$prodSelect}
        </fieldset>
EOT;
        return $html;
    }
コード例 #2
0
ファイル: core.php プロジェクト: plenigo/plenigo_six_plugin
 /**
  * if mathods are used static, then init has to be called first
  */
 public static function init()
 {
     if (!self::$initialized) {
         self::$secret = self::PIO()->ConfigGetSet('secret');
         self::$companyId = self::PIO()->ConfigGetSet('companyId');
         //configure plenigo:
         if (class_exists('\\plenigo\\PlenigoManager')) {
             \plenigo\PlenigoManager::configure(self::$secret, self::$companyId);
         }
     }
     self::$initialized = true;
 }
コード例 #3
0
 public function search($hSearch, $hOptions = array())
 {
     $table = $this->sTable;
     $this->log("search options", $hOptions);
     # wenn wir nichts finden geben wir auch mindestens die folgenden Daten zurueck..
     $hResult = array('ids' => array(), 'num' => 0, 'num_complete' => 0, 'total' => 0);
     if ('products' == $table) {
         $products = cl6Plugin_plenigo::getProducts();
         if (!is_null($products)) {
             $hResult['total'] = $products['totalElements'];
             $hResult['num'] = $products['size'];
             $hResult['num_complete'] = $products['totalElements'];
             if ($products['totalElements']) {
                 foreach ($products['elements'] as $element) {
                     $hResult['ids'][] = $element->productId;
                     //                        $hResult['data'][$element->productId] = array(
                     //                            'product_id' => $element->productId,
                     //                        );
                 }
             }
         }
     } elseif ('categories' == $table) {
         $categories = cl6Plugin_plenigo::getCategories();
         if (!is_null($categories)) {
             $hResult['total'] = $categories['totalElements'];
             $hResult['num'] = $categories['size'];
             $hResult['num_complete'] = $categories['totalElements'];
             if ($categories['totalElements']) {
                 foreach ($categories['elements'] as $element) {
                     $hResult['ids'][] = $element->categoryId;
                 }
             }
         }
     } else {
         $hResult['error'] = 'nothing found';
     }
     $this->log("search result", $hResult, false);
     return $hResult;
 }
コード例 #4
0
 public static function getUser($params)
 {
     $userData = parent::getPlenigoUser($params);
     if (is_null($userData)) {
         return;
     }
     return $userData->getEmail();
 }