Пример #1
0
 public function toRow()
 {
     $ret = parent::toRow();
     if (!isset($ret['day']) || $ret['day'] == '') {
         $ret['day'] = null;
     }
     return $ret;
 }
Пример #2
0
 public function toRow()
 {
     $ret = parent::toRow();
     if (@$ret['day'] == '') {
         $ret['day'] = null;
     }
     if (@$ret['product_id'] == '') {
         $ret['product_id'] = null;
     }
     return $ret;
 }
Пример #3
0
 public function afterInsert(array &$values, ResourceAbstract $record)
 {
     $record->clearAccess();
     if (!empty($values['_access']['free'])) {
         $record->addAccessListItem(0, null, null, ResourceAccess::FN_FREE);
     } else {
         if (!empty($values['_access']['product_category_id'])) {
             foreach ($values['_access']['product_category_id'] as $cat_id => $params) {
                 if (!is_array($params)) {
                     $params = json_decode($params, true);
                 }
                 $record->addAccessListItem($cat_id, $params['start'], $params['stop'], ResourceAccess::FN_CATEGORY);
             }
         }
         if (!empty($values['_access']['product_id'])) {
             foreach ($values['_access']['product_id'] as $product_id => $params) {
                 if (!is_array($params)) {
                     $params = json_decode($params, true);
                 }
                 $record->addAccessListItem($product_id, $params['start'], $params['stop'], ResourceAccess::FN_PRODUCT);
             }
         }
     }
 }
Пример #4
0
 public function afterInsert(array &$values, ResourceAbstract $record)
 {
     $record->setAccess($values['_access']);
 }
 public function renderCategory(ResourceAbstract $e)
 {
     $res = array();
     $options = $this->getDi()->resourceCategoryTable->getOptions();
     foreach ($e->getCategories() as $resc_id) {
         $res[] = $options[$resc_id];
     }
     return $this->renderTd(implode(", ", $res));
 }
 public function renderProducts(ResourceAbstract $resource)
 {
     $access_list = $resource->getAccessList();
     if (count($access_list) > 6) {
         $s = count($access_list) . ' access records...';
     } else {
         $s = "";
         foreach ($access_list as $access) {
             $s .= sprintf("%s <b>%s</b> %s<br />\n", $access->getClass(), $access->getTitle(), "");
         }
     }
     return $this->renderTd($s, false);
 }
Пример #7
0
 function getSignedLink(ResourceAbstract $media)
 {
     $rel = $media->pk() . '-' . ($this->getDi()->time + 3600 * 24);
     return ($this->getRequest()->isSecure() ? ROOT_SURL : ROOT_URL) . '/' . $this->type . '/d/id/' . $rel . '-' . $this->getDi()->app->getSiteHash('am-' . $this->type . '-' . $rel, 10);
 }