Exemplo n.º 1
0
 /**
  * Testing the getOptionID method.
  *
  * @since 1.0
  */
 public function testGetOptionID()
 {
     try {
         $options = $this->denum1->getOptions();
         $optionIDs = array_keys($options);
         $this->assertEquals($optionIDs[0], $this->denum1->getOptionID($options[$optionIDs[0]]), 'testing the getOptionID method');
     } catch (AlphaException $e) {
         $this->fail('testing the getOptionID method, exception: ' . $e->getMessage());
     }
 }
Exemplo n.º 2
0
 /**
  * Gets an array of the OIDs of the most recent articles added to the system (by date), from the newest
  * article to the amount specified by the $limit.
  *
  * @param int    $limit
  * @param string $excludeID
  *
  * @return array
  *
  * @since 1.0
  *
  * @throws Alpha\Exception\AlphaException
  */
 public function loadRecentWithLimit($limit, $excludeID = '')
 {
     if ($excludeID != '') {
         $denum = new DEnum('Alpha\\Model\\Article::section');
         $excludeID = $denum->getOptionID($excludeID);
     }
     $sqlQuery = 'SELECT OID FROM ' . $this->getTableName() . " WHERE published='1' AND section!='{$excludeID}' ORDER BY created_ts DESC LIMIT 0, {$limit};";
     $result = $this->query($sqlQuery);
     $OIDs = array();
     foreach ($result as $row) {
         array_push($OIDs, $row['OID']);
     }
     return $OIDs;
 }