/**
  * Return a test genre.
  * @param $genreId integer
  * @return Genre the test genre.
  */
 public function getTestGenre($genreId)
 {
     // Create a test genre.
     switch ($genreId) {
         case SUBMISSION_FILE_DAO_TEST_DOC_GENRE_ID:
             $category = GENRE_CATEGORY_DOCUMENT;
             $name = 'Document Genre';
             $designation = 'D';
             break;
         case SUBMISSION_FILE_DAO_TEST_ART_GENRE_ID:
             $category = GENRE_CATEGORY_ARTWORK;
             $name = 'Artwork Genre';
             $designation = 'A';
             break;
         default:
             self::fail();
     }
     $genre = new Genre();
     $application = PKPApplication::getApplication();
     $request = $application->getRequest();
     $press = $request->getContext();
     $genre->setContextId($press->getId());
     $genre->setId($genreId);
     $genre->setName($name, 'en_US');
     $genre->setDesignation($designation);
     $genre->setCategory($category);
     return $genre;
 }
예제 #2
0
 $result = $doc->getElementsByTagName("contentGroup");
 // cada contentGroup corresponde a un genero
 if ($result->length > 0) {
     // si tengo generos para recorrer
     foreach ($result as $itemNumber => $xmlGenre) {
         $xmlItem = $result->item($itemNumber);
         if ($xmlItem->hasAttributes()) {
             $genre = new Genre();
             // obtengo valores de los atributos que necesito
             foreach ($xmlItem->attributes as $attrName => $attrValue) {
                 if ($attrName == "id") {
                     $genre->setId($attrValue->nodeValue);
                 }
                 //
                 if ($attrName == "name") {
                     $genre->setName($attrValue->nodeValue);
                 }
                 //
             }
             // estos grupos no se guardan en la database
             // deberian guardarse con activo=0 pero voy a skippear porque no se si la web lo toma en cuenta... je :S
             if ($genre->getId() != "15680" && $genre->getId() != "15679") {
                 $saved = $genre->save($dbc, "generos");
                 if ($saved === TRUE) {
                     $ok++;
                 } else {
                     $error++;
                     $log->add("ERROR SQL: " . mysql_error());
                 }
             } else {
                 $skipped++;