Ejemplo n.º 1
0
 public function build($runData)
 {
     $site = $runData->getTemp("site");
     $runData->contextAdd("site", $site);
     // get all categories for the site
     $c = new Criteria();
     $c->add("site_id", $site->getSiteId());
     $c->addOrderAscending("replace(name, '_', '00000000')");
     $categories = DB_CategoryPeer::instance()->select($c);
     $runData->contextAdd("categories", $categories);
     // also prepare categories to put into javascript...
     $cats2 = array();
     foreach ($categories as $category) {
         $cats2[] = $category->getFieldValuesArray();
     }
     $runData->ajaxResponseAdd("categories", $cats2);
     // get licences
     $c = new Criteria();
     $c->addOrderAscending("sort");
     $c->addOrderAscending("name");
     $licenses = DB_LicensePeer::instance()->select($c);
     $runData->contextAdd("licenses", $licenses);
 }
Ejemplo n.º 2
0
 public function getLicenseText()
 {
     if ($this->getName() === '_default') {
         if ($this->getLicenseId() == 1) {
             return $this->getLicenseOther();
         } else {
             $license = DB_LicensePeer::instance()->selectById($this->getLicenseId());
             return $license->getDescription();
         }
     } else {
         if ($this->getLicenseDefault()) {
             // get default license (for the '_default' category
             $dc = DB_CategoryPeer::instance()->selectByName('_default', $this->getSiteId());
             return $dc->getLicenseText();
         } else {
             if ($this->getLicenseId() == 1) {
                 return $this->getLicenseOther();
             } else {
                 $license = DB_LicensePeer::instance()->selectById($this->getLicenseId());
                 return $license->getDescription();
             }
         }
     }
 }