Exemple #1
0
 public function getProduct($className = null)
 {
     if (!isset($this->product)) {
         if (empty($className)) {
             $className = $this->productClassName;
         }
         $this->product = \Cpeople\Classes\Block\Getter::instance()->setClassName($className)->getById($this['PRODUCT_ID']);
     }
     return $this->product;
 }
Exemple #2
0
 protected function fillCatalogData()
 {
     static $result = array();
     if (!isset($result[$this->ID])) {
         $ar = \Cpeople\Classes\Block\Getter::instance()->setSelectFields(array('ID', 'CATALOG_QUANTITY'))->getArrayById($this->ID);
         foreach ($ar as $key => $val) {
             if ($this->data[$key] === null) {
                 $this->data[$key] = $val;
             }
         }
         $result[$this->ID] = true;
     }
 }
Exemple #3
0
function cp_get_iblock_dates($filter = array())
{
    $dates = array();
    \Cpeople\Classes\Block\Getter::instance()->setOrder(array('DATE_ACTIVE_FROM' => 'DESC'))->setFilter($filter)->setHydrationMode(\Cpeople\Classes\Block\Getter::HYDRATION_MODE_ARRAY)->setSelectFields(array('DATE_ACTIVE_FROM'))->addCallback(function ($element) use(&$dates) {
        $timestamp = strtotime($element['ACTIVE_FROM']);
        $dates[date('Y', $timestamp)][date('n', $timestamp)]++;
    })->get();
    return $dates;
}
Exemple #4
0
 /**
  * @return \Cpeople\Classes\Block\Object|\Cpeople\Classes\Section\Object
  */
 public function getElement()
 {
     if ($this->element === null) {
         $itemId = $this->getItemID();
         $isSection = !is_numeric($itemId);
         if ($isSection) {
             $itemId = substr($itemId, 1);
             $instance = \Cpeople\Classes\Section\Getter::instance();
         } else {
             $instance = \Cpeople\Classes\Block\Getter::instance();
         }
         $this->element = $instance->getById($itemId);
     }
     return $this->element;
 }