/**
  * Returns a new CcBlockcriteriaQuery object.
  *
  * @param     string $modelAlias The alias of a model in the query
  * @param     Criteria $criteria Optional Criteria to build the query from
  *
  * @return    CcBlockcriteriaQuery
  */
 public static function create($modelAlias = null, $criteria = null)
 {
     if ($criteria instanceof CcBlockcriteriaQuery) {
         return $criteria;
     }
     $query = new CcBlockcriteriaQuery();
     if (null !== $modelAlias) {
         $query->setModelAlias($modelAlias);
     }
     if ($criteria instanceof Criteria) {
         $query->mergeWith($criteria);
     }
     return $query;
 }
 /**
  * Removes this object from datastore and sets delete attribute.
  *
  * @param      PropelPDO $con
  * @return     void
  * @throws     PropelException
  * @see        BaseObject::setDeleted()
  * @see        BaseObject::isDeleted()
  */
 public function delete(PropelPDO $con = null)
 {
     if ($this->isDeleted()) {
         throw new PropelException("This object has already been deleted.");
     }
     if ($con === null) {
         $con = Propel::getConnection(CcBlockcriteriaPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
     }
     $con->beginTransaction();
     try {
         $ret = $this->preDelete($con);
         if ($ret) {
             CcBlockcriteriaQuery::create()->filterByPrimaryKey($this->getPrimaryKey())->delete($con);
             $this->postDelete($con);
             $con->commit();
             $this->setDeleted(true);
         } else {
             $con->commit();
         }
     } catch (PropelException $e) {
         $con->rollBack();
         throw $e;
     }
 }
示例#3
0
 /**
  * Returns the number of related CcBlockcriteria objects.
  *
  * @param      Criteria $criteria
  * @param      boolean $distinct
  * @param      PropelPDO $con
  * @return     int Count of related CcBlockcriteria objects.
  * @throws     PropelException
  */
 public function countCcBlockcriterias(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
 {
     if (null === $this->collCcBlockcriterias || null !== $criteria) {
         if ($this->isNew() && null === $this->collCcBlockcriterias) {
             return 0;
         } else {
             $query = CcBlockcriteriaQuery::create(null, $criteria);
             if ($distinct) {
                 $query->distinct();
             }
             return $query->filterByCcBlock($this)->count($con);
         }
     } else {
         return count($this->collCcBlockcriterias);
     }
 }
示例#4
0
文件: Block.php 项目: nidzix/Airtime
 public function getCriteria()
 {
     $criteriaOptions = array(0 => "Select criteria", "album_title" => "Album", "bit_rate" => "Bit Rate (Kbps)", "bpm" => "BPM", "composer" => "Composer", "conductor" => "Conductor", "copyright" => "Copyright", "artist_name" => "Creator", "encoded_by" => "Encoded By", "genre" => "Genre", "isrc_number" => "ISRC", "label" => "Label", "language" => "Language", "mtime" => "Last Modified", "lptime" => "Last Played", "length" => "Length", "mime" => "Mime", "mood" => "Mood", "owner_id" => "Owner", "replay_gain" => "Replay Gain", "sample_rate" => "Sample Rate (kHz)", "track_title" => "Title", "track_number" => "Track Number", "utime" => "Uploaded", "info_url" => "Website", "year" => "Year");
     // Load criteria from db
     $out = CcBlockcriteriaQuery::create()->orderByDbCriteria()->findByDbBlockId($this->id);
     $storedCrit = array();
     foreach ($out as $crit) {
         $criteria = $crit->getDbCriteria();
         $modifier = $crit->getDbModifier();
         $value = $crit->getDbValue();
         $extra = $crit->getDbExtra();
         if ($criteria == "limit") {
             $storedCrit["limit"] = array("value" => $value, "modifier" => $modifier);
         } else {
             $storedCrit["crit"][$criteria][] = array("criteria" => $criteria, "value" => $value, "modifier" => $modifier, "extra" => $extra, "display_name" => $criteriaOptions[$criteria]);
         }
     }
     return $storedCrit;
 }
示例#5
0
 public function getCriteria()
 {
     $criteriaOptions = array(0 => _("Select criteria"), "album_title" => _("Album"), "bit_rate" => _("Bit Rate (Kbps)"), "bpm" => _("BPM"), "composer" => _("Composer"), "conductor" => _("Conductor"), "copyright" => _("Copyright"), "cuein" => _("Cue In"), "cueout" => _("Cue Out"), "artist_name" => _("Creator"), "encoded_by" => _("Encoded By"), "genre" => _("Genre"), "isrc_number" => _("ISRC"), "label" => _("Label"), "language" => _("Language"), "mtime" => _("Last Modified"), "lptime" => _("Last Played"), "length" => _("Length"), "mime" => _("Mime"), "mood" => _("Mood"), "owner_id" => _("Owner"), "replay_gain" => _("Replay Gain"), "sample_rate" => _("Sample Rate (kHz)"), "track_title" => _("Title"), "track_number" => _("Track Number"), "utime" => _("Uploaded"), "info_url" => _("Website"), "year" => _("Year"));
     $modifierOptions = array("0" => _("Select modifier"), "contains" => _("contains"), "does not contain" => _("does not contain"), "is" => _("is"), "is not" => _("is not"), "starts with" => _("starts with"), "ends with" => _("ends with"), "is" => _("is"), "is not" => _("is not"), "is greater than" => _("is greater than"), "is less than" => _("is less than"), "is in the range" => _("is in the range"));
     // Load criteria from db
     $out = CcBlockcriteriaQuery::create()->orderByDbCriteria()->findByDbBlockId($this->id);
     $storedCrit = array();
     foreach ($out as $crit) {
         $criteria = $crit->getDbCriteria();
         $modifier = $crit->getDbModifier();
         $value = htmlspecialchars($crit->getDbValue());
         $extra = $crit->getDbExtra();
         if ($criteria == "limit") {
             $storedCrit["limit"] = array("value" => $value, "modifier" => $modifier, "display_modifier" => _($modifier));
         } else {
             if ($criteria == "repeat_tracks") {
                 $storedCrit["repeat_tracks"] = array("value" => $value);
             } else {
                 $storedCrit["crit"][$criteria][] = array("criteria" => $criteria, "value" => $value, "modifier" => $modifier, "extra" => $extra, "display_name" => $criteriaOptions[$criteria], "display_modifier" => $modifierOptions[$modifier]);
             }
         }
     }
     return $storedCrit;
 }