/** * @see DataObjectRequiredPolicy::dataObjectEffect() */ function dataObjectEffect() { $issueId = (int) $this->getDataObjectId(); if (!$issueId) { return AUTHORIZATION_DENY; } // Make sure the issue belongs to the journal. $issueDao = DAORegistry::getDAO('IssueDAO'); if ($this->journal->getSetting('enablePublicIssueId')) { $issue = $issueDao->getByBestId($issueId, $this->journal->getId()); } else { $issue = $issueDao->getById((int) $issueId, null, true); } if (!is_a($issue, 'Issue')) { return AUTHORIZATION_DENY; } // The issue must be published, or we must have pre-publication // access to it. $userRoles = $this->getAuthorizedContextObject(ASSOC_TYPE_USER_ROLES); if (!$issue->getPublished() && count(array_intersect($userRoles, array(ROLE_ID_SITE_ADMIN, ROLE_ID_MANAGER, ROLE_ID_SECTION_EDITOR, ROLE_ID_ASSISTANT))) == 0) { return AUTHORIZATION_DENY; } // Save the issue to the authorization context. $this->addAuthorizedContextObject(ASSOC_TYPE_ISSUE, $issue); return AUTHORIZATION_PERMIT; }
public function actionUpgrade() { $player = Player::model()->findByAttributes(array('email' => Yii::app()->user->id)); $ship = Ship::model()->findByAttributes(array('id' => $player->id)); if ($ship == null) { $this->redirect($this->createUrl('player/Needship')); return; } // Получить ссылку на все предметы игрока $person_prototype_items_shop = $ship->getBuyNextMagazinesForType(); if (!isset($_GET['type'])) { $this->redirect($this->createUrl('player/myship')); return; } $type_item = $_GET['type']; // Получить текущий список по типу покупаемой вещи $type_buy = $person_prototype_items_shop[$type_item]; // Получить текущую ИД текущей установленной вещи $id_ship_item = $ship->getParamForKeyPrototype($type_item); // Получить покупаемую вещь (следующюю по счету) $buy_item = $type_buy[$id_ship_item + 1]; if ($player->setSummBuyPlus(-$buy_item['summ'])) { $ship->setNewItemToshipAndUpdateSummship($type_item, $buy_item['summ'], $buy_item['gfx_ship']); $journal = new Journal(); $journal->item_id = $buy_item['id']; $journal->type = $type_item; $journal->summ = $buy_item['summ']; $journal->id_player = $player->id; $journal->save(); $this->redirect($this->createUrl('/player/myship')); } else { $this->render('noMoney'); } }
public function addCredit($date, $desc, $amount) { global $wpdb; $sql = "INSERT INTO " . $wpdb->prefix . "bestbooks_ledger (name,txdate,note,credit,balance,type) VALUES ('{$this->name}','{$date}','{$desc}','{$amount}','{$this->balance}','{$this->type}')"; $result = $wpdb->query($sql); if ($result === false) { throw new BestBooksException("Ledger table insertion failure: " . $sql); } $this->credit = $amount; $journal = new Journal(); $journal->add($date, 0, $this->name, 0.0, $amount); return "Credit amount:" . $amount . " inserted correctly into Ledger:" . $this->name; }
public function debitAccount($data, $trans_no) { $journal = new Journal(); $account = Account::findOrFail($data['debit_account']); $journal->account()->associate($account); $journal->date = $data['date']; $journal->trans_no = $trans_no; $journal->initiated_by = $data['initiated_by']; $journal->amount = $data['amount']; $journal->type = 'debit'; $journal->description = $data['description']; $journal->save(); }
public function run() { DB::table('journals')->truncate(); $faker = Faker\Factory::create(); foreach (range(1, 50) as $index) { $journal = new Journal(); $journal->user_id = $faker->randomDigit(); $journal->publish_date = Carbon::instance($faker->dateTimeBetween($startDate = Config::get('constants.ANNIVERSARY'))); $journal->volume = $journal->publish_date->diffInMonths(Config::get('constants.ANNIVERSARY')) + 2; $journal->day = $journal->publish_date->diffInDays(Config::get('constants.ANNIVERSARY')) + 1; $journal->contents = implode("\n\n", $faker->paragraphs(5)); $journal->special_events = implode("\n", $faker->sentences(2)); $journal->save(); } }
/** * Send x copies of the registered item to a user. * * @param integer|Model_User $user * @param integer $amount * @param string $location * * @throws Item_Exception */ public function to_user($user, $origin = "app", $amount = 1, $location = 'inventory') { if (!Valid::digit($amount)) { throw new Item_Exception('The supplied amount should be a number.'); } if (Valid::digit($user)) { $user = ORM::factory('User', $user); } elseif (!is_a($user, 'Model_User')) { throw new Item_Exception('The supplied user does not come from a model.'); } if (!$user->loaded()) { throw new Item_Exception('The supplied user does not exist.'); } else { $user_item = ORM::factory('User_Item')->where('user_id', '=', $user->id)->where('item_id', '=', $this->_item->id)->where('location', '=', $location)->find(); $action = $amount > 0 ? '+' : '-'; if ($user_item->loaded()) { // update item amount $user_item->amount($action, $amount); } elseif ($action == '+') { $id = $this->_item->id; // create new copy $user_item = ORM::factory('User_Item')->values(array('user_id' => $user->id, 'item_id' => $id, 'location' => $location, 'amount' => $amount))->save(); } return Journal::log('item.in.' . $origin, 'item', 'Player received :amount :item_name @ :origin', array(':amount' => $amount, ':item_name' => $user_item->item->name($amount, FALSE), ':origin' => str_replace('.', ' ', $origin))); } }
/** * @return null|object|Journal * get singleton instance */ public static function getInstance() { if (!self::$instance) { self::$instance = new Journal(); } return self::$instance; }
/** * Store a newly created savingtransaction in storage. * * @return Response */ public function store() { $validator = Validator::make($data = Input::all(), Savingtransaction::$rules); if ($validator->fails()) { return Redirect::back()->withErrors($validator)->withInput(); } $date = Input::get('date'); $transAmount = Input::get('amount'); $savingaccount = Savingaccount::findOrFail(Input::get('account_id')); $savingtransaction = new Savingtransaction(); $savingtransaction->date = Input::get('date'); $savingtransaction->savingaccount()->associate($savingaccount); $savingtransaction->amount = Input::get('amount'); $savingtransaction->type = Input::get('type'); $savingtransaction->description = Input::get('description'); $savingtransaction->transacted_by = Input::get('transacted_by'); $savingtransaction->save(); // withdrawal if (Input::get('type') == 'debit') { foreach ($savingaccount->savingproduct->savingpostings as $posting) { if ($posting->transaction == 'withdrawal') { $debit_account = $posting->debit_account; $credit_account = $posting->credit_account; } } $data = array('credit_account' => $credit_account, 'debit_account' => $debit_account, 'date' => Input::get('date'), 'amount' => Input::get('amount'), 'initiated_by' => 'system', 'description' => 'cash withdrawal'); $journal = new Journal(); $journal->journal_entry($data); Savingtransaction::withdrawalCharges($savingaccount, $date, $transAmount); Audit::logAudit(date('Y-m-d'), Confide::user()->username, 'savings withdrawal', 'Savings', Input::get('amount')); } // deposit if (Input::get('type') == 'credit') { foreach ($savingaccount->savingproduct->savingpostings as $posting) { if ($posting->transaction == 'deposit') { $debit_account = $posting->debit_account; $credit_account = $posting->credit_account; } } $data = array('credit_account' => $credit_account, 'debit_account' => $debit_account, 'date' => Input::get('date'), 'amount' => Input::get('amount'), 'initiated_by' => 'system', 'description' => 'cash deposit'); $journal = new Journal(); $journal->journal_entry($data); Audit::logAudit(date('Y-m-d'), Confide::user()->username, 'savings deposit', 'Savings', Input::get('amount')); } return Redirect::to('savingtransactions/show/' . $savingaccount->id); }
/** * Transfer the initialised item to a different user. * * Returns false if you're trying to transfer a higher amount of this item than the owner already has, * if successfull it will return a user item instance of where the item copies transfered to. * * @param Model_User $user A user model instance of the new owner * @param Integer $amount The amount of copies you want to transfer * * @throws Item_Exception When trying to transfer an untransferable item * @return boolean|Model_User_Item */ public function transfer(Model_User $user, $amount = 1) { if ($this->item->transferable == FALSE) { throw new Item_Exception('":item" is bound to your account only.', array(':item' => $this->item->name)); } else { $this->_relocate($user->id, 'inventory', $amount); return Journal::log('transfer' . $this->item->id, 'items.gift', ':item_name transferred to :other_user', array(':item_name' => $this->item->name, ':other_user' => $user->username)); } }
public function __construct($component, $type, $error, $context = NULL, &$object = NULL) { parent::__construct('Framework error'); $this->type = $type; $this->component = $component; $this->error = $error; $this->context = $context; $this->object = $object; $this->timeline = Journal::timeline(); }
function addBestBooksTables() { global $wpdb; if (is_admin()) { ChartOfAccounts::createTable(); Journal::createTable(); Ledger::createTable(); } // endif of is_admin() }
public function __construct() { if (MODE == 'DEVELOPMENT' && LOG) { $this->file = new \File(BASE_FOLDER . LOG_DIR . '/devlog.log'); $this->log('-- Execution started --'); } elseif (LOG) { $this->file = new \File(BASE_FOLDER . LOG_DIR . '/' . Journal::getDailyLog() . '.log'); $this->log('-- Execution started --'); } // @TODO : Backtrace }
/** * Register the article's metadata with the SWORD deposit. */ function setMetadata() { $this->package->setCustodian($this->journal->getSetting('contactName')); $this->package->setTitle(html_entity_decode($this->article->getTitle($this->journal->getPrimaryLocale()), ENT_QUOTES, 'UTF-8')); $this->package->setAbstract(html_entity_decode(strip_tags($this->article->getAbstract($this->journal->getPrimaryLocale())), ENT_QUOTES, 'UTF-8')); $this->package->setType($this->section->getIdentifyType($this->journal->getPrimaryLocale())); // The article can be published or not. Support either. if (is_a($this->article, 'PublishedArticle')) { $doi = $this->article->getPubId('doi'); if ($doi !== null) { $this->package->setIdentifier($doi); } } foreach ($this->article->getAuthors() as $author) { $creator = $author->getFullName(true); $affiliation = $author->getAffiliation($this->journal->getPrimaryLocale()); if (!empty($affiliation)) { $creator .= "; {$affiliation}"; } $this->package->addCreator($creator); } // The article can be published or not. Support either. if (is_a($this->article, 'PublishedArticle')) { $plugin = PluginRegistry::loadPlugin('citationFormats', 'bibtex'); $this->package->setCitation(html_entity_decode(strip_tags($plugin->fetchCitation($this->article, $this->issue, $this->journal)), ENT_QUOTES, 'UTF-8')); } }
/** * Internal function to return a Journal object from a row. * @param $row array * @return Journal */ function &_returnJournalFromRow(&$row) { $journal = new Journal(); $journal->setId($row['journal_id']); $journal->setPath($row['path']); $journal->setSequence($row['seq']); $journal->setEnabled($row['enabled']); $journal->setPrimaryLocale($row['primary_locale']); HookRegistry::call('JournalDAO::_returnJournalFromRow', array(&$journal, &$row)); return $journal; }
function updateTables($version) { Auth::updateTables($version); Comment::updateTables($version); Feedback::updateTables($version); Journal::updateTables($version); Media::updateTables($version); Setting::updateTables($version); Trip::updateTables($version); TripAttribute::updateTables($version); TripUser::updateTables($version); User::updateTables($version); print "Tables have been updated. "; }
public function storeData($walletID) { $attributes = $this->apiAttributes(); $character = Characters::Model()->findByPk($walletID); //Retrieve the XML dataset $journal = $this->getEVEData($walletID); if (!isset($journal->error)) { foreach ($journal->result->rowset->row as $row) { if ($character->limitUpdate) { $orderTime = strtotime($row->attributes()->date); $timeLimit = strtotime($character->limitDate); } else { $orderTime = 1; $timeLimit = 0; } $exist = Journal::Model()->exists('refID=:refID', array(':refID' => $row->attributes()->refID)); if (!$exist && $orderTime > $timeLimit) { $orderRow = new Journal(); $orderRow->date = $row->attributes()->date; $orderRow->refID = $row->attributes()->refID; $orderRow->refTypeID = $row->attributes()->refTypeID; $orderRow->ownerName1 = $row->attributes()->ownerName1; $orderRow->ownerID1 = $row->attributes()->ownerID1; $orderRow->ownerName2 = $row->attributes()->ownerName2; $orderRow->ownerID2 = $row->attributes()->ownerID2; $orderRow->argName1 = $row->attributes()->argName1; $orderRow->argID1 = $row->attributes()->argID1; $orderRow->amount = $row->attributes()->amount; $orderRow->balance = $row->attributes()->balance; $orderRow->reason = $row->attributes()->reason; $orderRow->characterID = $walletID; $orderRow->save(); } } } }
public function testUpdateDatabase() { $version = Setting::getDataVersion(); $this->assertTrue(Auth::updateTables($version, '')); $this->assertTrue(Comment::updateTables($version, '')); $this->assertTrue(Feedback::updateTables($version, '')); $this->assertTrue(Journal::updateTables($version, '')); $this->assertTrue(Media::updateTables($version, '')); $this->assertTrue(Trip::updateTables($version, '')); $this->assertTrue(TripAttribute::updateTables($version, '')); $this->assertTrue(TripUser::updateTables($version, '')); $this->assertTrue(User::updateTables($version, '')); // Note: make sure the Settings::updateTables is last: when any of the // above fail, the data version in the database should NOT be updated! $this->assertTrue(Setting::updateTables($version, '')); }
/** * @return \yii\db\ActiveQuery */ public function getJournals() { return $this->hasMany(Journal::className(), ['user_id' => 'id']); }
public function searchArticleByKeyword($key, $categoryId) { if ($categoryId == 0) { $this->mArticles = Journal::SearchArticleByKeyword($key); echo json_encode($this->mArticles); } else { $this->mArticles = Journal::SearchCategoryArticleByKeyword($key, $categoryId); echo json_encode($this->mArticles); } }
/** * Save journal settings. */ function execute() { $journalDao =& DAORegistry::getDAO('JournalDAO'); if (isset($this->journalId)) { $journal =& $journalDao->getJournal($this->journalId); } if (!isset($journal)) { $journal = new Journal(); } $journal->setPath($this->getData('journalPath')); $journal->setEnabled($this->getData('enabled')); if ($journal->getId() != null) { $isNewJournal = false; $journalDao->updateJournal($journal); $section = null; } else { $isNewJournal = true; $site =& Request::getSite(); // Give it a default primary locale $journal->setPrimaryLocale($site->getPrimaryLocale()); $journalId = $journalDao->insertJournal($journal); $journalDao->resequenceJournals(); // Make the site administrator the journal manager of newly created journals $sessionManager =& SessionManager::getManager(); $userSession =& $sessionManager->getUserSession(); if ($userSession->getUserId() != null && $userSession->getUserId() != 0 && !empty($journalId)) { $role = new Role(); $role->setJournalId($journalId); $role->setUserId($userSession->getUserId()); $role->setRoleId(ROLE_ID_JOURNAL_MANAGER); $roleDao =& DAORegistry::getDAO('RoleDAO'); $roleDao->insertRole($role); } // Make the file directories for the journal import('lib.pkp.classes.file.FileManager'); FileManager::mkdir(Config::getVar('files', 'files_dir') . '/journals/' . $journalId); FileManager::mkdir(Config::getVar('files', 'files_dir') . '/journals/' . $journalId . '/articles'); FileManager::mkdir(Config::getVar('files', 'files_dir') . '/journals/' . $journalId . '/issues'); FileManager::mkdir(Config::getVar('files', 'public_files_dir') . '/journals/' . $journalId); // Install default journal settings $journalSettingsDao =& DAORegistry::getDAO('JournalSettingsDAO'); $titles = $this->getData('title'); AppLocale::requireComponents(array(LOCALE_COMPONENT_OJS_DEFAULT, LOCALE_COMPONENT_APPLICATION_COMMON)); $journalSettingsDao->installSettings($journalId, 'registry/journalSettings.xml', array('indexUrl' => Request::getIndexUrl(), 'journalPath' => $this->getData('journalPath'), 'primaryLocale' => $site->getPrimaryLocale(), 'journalName' => $titles[$site->getPrimaryLocale()])); // Install the default RT versions. import('classes.rt.ojs.JournalRTAdmin'); $journalRtAdmin = new JournalRTAdmin($journalId); $journalRtAdmin->restoreVersions(false); // Create a default "Articles" section $sectionDao =& DAORegistry::getDAO('SectionDAO'); $section = new Section(); $section->setJournalId($journal->getId()); $section->setTitle(__('section.default.title'), $journal->getPrimaryLocale()); $section->setAbbrev(__('section.default.abbrev'), $journal->getPrimaryLocale()); $section->setMetaIndexed(true); $section->setMetaReviewed(true); $section->setPolicy(__('section.default.policy'), $journal->getPrimaryLocale()); $section->setEditorRestricted(false); $section->setHideTitle(false); $sectionDao->insertSection($section); } $journal->updateSetting('title', $this->getData('title'), 'string', true); $journal->updateSetting('description', $this->getData('description'), 'string', true); // Make sure all plugins are loaded for settings preload PluginRegistry::loadAllPlugins(); HookRegistry::call('JournalSiteSettingsForm::execute', array(&$this, &$journal, &$section, &$isNewJournal)); }
/** * retrieve balance sheet from database. * role: player */ public function retrieve_balance() { if (Authenticate::is_player()) { if (isset($_POST['token']) && Authenticate::is_valid_token($_POST['token'])) { $this->model_journal = Journal::getInstance(); /* * invoke method to retrieve balance data. * convert into json format and binding these data. */ $result = $this->model_journal->get_balance_sheet(); $binding = array("result_var" => "session_ready", "balance_var" => json_encode($result, JSON_PRETTY_PRINT)); binding_data($binding); } else { transport("error404"); } } else { $binding = array("result_var" => "no_session"); binding_data($binding); } }
/** * Adds an object to the instance pool. * * Propel keeps cached copies of objects in an instance pool when they are retrieved * from the database. In some cases -- especially when you override doSelect*() * methods in your stub classes -- you may need to explicitly add objects * to the cache in order to ensure that the same objects are always returned by doSelect*() * and retrieveByPK*() calls. * * @param Journal $obj A Journal object. * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally). */ public static function addInstanceToPool($obj, $key = null) { if (Propel::isInstancePoolingEnabled()) { if ($key === null) { $key = (string) $obj->getId(); } // if key === null JournalPeer::$instances[$key] = $obj; } }
function createJournal() { $journalConfigXML = $this->getCurrentElementAsDom(); $journalDao =& DAORegistry::getDAO("JournalDAO"); $journal = new Journal(); $journal->setPath((string) $journalConfigXML->path); $journal->setEnabled((int) $journalConfigXML->enabled); $journal->setPrimaryLocale((string) $journalConfigXML->primaryLocale); $this->generateJournalPath($journal); $journalId = $journalDao->insertJournal($journal); $journalDao->resequenceJournals(); // Make the file directories for the journal import('lib.pkp.classes.file.FileManager'); $fileManager = new FileManager(); if (!file_exists(Config::getVar('files', 'files_dir') . '/journals/' . $journalId)) { $fileManager->mkdir(Config::getVar('files', 'files_dir') . '/journals/' . $journalId); } if (!file_exists(Config::getVar('files', 'files_dir') . '/journals/' . $journalId . '/articles')) { $fileManager->mkdir(Config::getVar('files', 'files_dir') . '/journals/' . $journalId . '/articles'); } if (!file_exists(Config::getVar('files', 'files_dir') . '/journals/' . $journalId . '/issues')) { $fileManager->mkdir(Config::getVar('files', 'files_dir') . '/journals/' . $journalId . '/issues'); } if (!file_exists(Config::getVar('files', 'public_files_dir') . '/journals/' . $journalId)) { $fileManager->mkdir(Config::getVar('files', 'public_files_dir') . '/journals/' . $journalId); } import('classes.rt.ojs.JournalRTAdmin'); $journalRtAdmin = new JournalRTAdmin($journalId); $journalRtAdmin->restoreVersions(false); // Make sure all plugins are loaded for settings preload PluginRegistry::loadAllPlugins(); HookRegistry::call('JournalSiteSettingsForm::execute', array(&$this, &$journal, &$section, &$isNewJournal)); $journalSettingsDao =& DAORegistry::getDAO('JournalSettingsDAO'); $this->restoreDataObjectSettings($journalSettingsDao, $journalConfigXML->settings, "journal_settings", "journal_id", $journal->getId()); $this->journal = $journal; }
public static function creditAccounts($data) { $savingaccount = Savingaccount::findOrFail(array_get($data, 'account_id')); $savingtransaction = new Savingtransaction(); $savingtransaction->date = array_get($data, 'date'); $savingtransaction->savingaccount()->associate($savingaccount); $savingtransaction->amount = array_get($data, 'amount'); $savingtransaction->type = array_get($data, 'type'); $savingtransaction->description = 'savings deposit'; $savingtransaction->save(); // deposit if (array_get($data, 'type') == 'credit') { foreach ($savingaccount->savingproduct->savingpostings as $posting) { if ($posting->transaction == 'deposit') { $debit_account = $posting->debit_account; $credit_account = $posting->credit_account; } } $data = array('credit_account' => $credit_account, 'debit_account' => $debit_account, 'date' => array_get($data, 'date'), 'amount' => array_get($data, 'amount'), 'initiated_by' => 'system', 'description' => 'cash deposit'); $journal = new Journal(); $journal->journal_entry($data); Audit::logAudit(date('Y-m-d'), Confide::user()->username, 'savings deposit', 'Savings', array_get($data, 'amount')); } }
} } $errorPage->ReturnButtonURL = "~/community/members"; $errorPage->ReturnButtonText = "Return to User List"; $errorPage->Render(); return; } } switch ($path[2]) { case "journals": if ($path[4] == "entries.rss" || $path[4] == "entries.atom") { require "journal/detail.inc.php"; return; } else { if ($path[4] == "entries" && $path[6] == "comment") { $journal = Journal::GetByIDOrName($path[3]); if ($journal == null) { return; } $entry = JournalEntry::GetByIDOrName($path[5]); $entryUrl = System::ExpandRelativePath("~/community/members/" . $thisuser->ShortName . "/journals/" . $journal->Name . "/entries/" . $entry->Name); switch ($path[6]) { case "comment": if ($_SERVER["REQUEST_METHOD"] == "POST") { $reply_to = null; if ($_POST["reply_comment_id"] != null) { $reply_to = JournalEntryComment::GetByID($_POST["reply_comment_id"]); } $title = $_POST["comment_title"]; $content = $_POST["comment_content"]; if (!$entry->AddComment($title, $content, $reply_to)) {
public static function fetchByName($title, $fund, $period, $type, $author, $accountno, $preparedby1, $preparedby2, $certifiedby1, $certifiedby2) { if (!$title) { return; } //remove "page 1" from title $start = strpos($title, " page "); if ($start === false) { $journaltitle = $title; } else { $journaltitle = substr($title, 0, $start); } //search journal with title in database //if not found, create $journal = Doctrine::getTable('Journal')->findOneByName($journaltitle); if (!$journal) { //create one $journal = new Journal(); $journal->setName($journaltitle); $journal->setFundId($fund->getId()); $journal->setPeriodId($period->getId()); $journal->setType($type); $journal->setAuthor($author); $journal->setAccountno($accountno); $journal->setPreparedby1($preparedby1); $journal->setPreparedby2($preparedby2); $journal->setCertifiedby1($certifiedby1); $journal->setCertifiedby2($certifiedby2); $journal->save(); } return $journal; }
function testLastEntry() { $content = "What is the meaning of life?"; $date = date("Y-m-d"); $test_journal = new Journal($content, $date); $test_journal->save(); $content2 = "I hate my dad"; $date2 = "2012-09-13"; $test_journal2 = new Journal($content2, $date2); $test_journal2->save(); $result = Journal::lastEntry(); $this->assertEquals($date, $result); }
/** * Remove the specified journal from storage. * * @param int $id * @return Response */ public function destroy($id) { $journal = Journal::findOrFail($id); $journal->void = TRUE; $journal->update(); return Redirect::route('journals.index'); }
$response['journalTitle'] = $object->getJournalTitle(); $response['journalText'] = $object->getJournalText(); $response['deleted'] = $object->getDeleted(); $response['hash'] = $object->getHash(); } } } else { $response = errorResponse(RESPONSE_BAD_REQUEST, 'hash not set'); } } else { if (isPutMethod()) { $data = getPostData(); if (isset($data['tripId']) && isset($data['journalId']) && $data['tripId'] !== '' && $data['journalId'] !== '') { $tripId = $data['tripId']; $journalId = $data['journalId']; $object = new Journal($tripId, $journalId); if (isset($data['created'])) { $object->setCreated($data['created']); } if (isset($data['updated'])) { $object->setUpdated($data['updated']); } if (isset($data['userId'])) { $object->setUserId($data['userId']); } if (isset($data['journalDate'])) { $object->setJournalDate($data['journalDate']); } if (isset($data['journalTitle'])) { $object->setJournalTitle($data['journalTitle']); }
/** * Retrieves the CSS/style files associated with this HTML galley by looking at the submission_file genre. * @param ArticleGalley $galley * @param Journal $journal * @return array SubmissionFiles */ function _getStyleFiles($galley, $fileId, $journal) { $genreDao = DAORegistry::getDAO('GenreDAO'); $styleGenre = $genreDao->getByType('STYLE', $journal->getId()); $styleFiles = array(); $submissionFileDao = DAORegistry::getDAO('SubmissionFileDAO'); $dependentFiles = $submissionFileDao->getLatestRevisionsByAssocId(ASSOC_TYPE_SUBMISSION_FILE, $fileId, $galley->getSubmissionId(), SUBMISSION_FILE_DEPENDENT); foreach ($dependentFiles as $file) { if ($file->getGenreId() == $styleGenre->getId()) { if ($file->getFileType() != 'text/css' && preg_match('/\\.css$/', $file->getOriginalFileName())) { $file->setFileType('text/css'); $submissionFileDao->updateObject($file); } $styleFiles[] = $file; } } return $styleFiles; }