Beispiel #1
0
 public static function remove($name)
 {
     $sectionManager = new Section();
     $sectionManager->load(array('label' => $name));
     $rightManager = new Right();
     $rightManager->delete(array('section' => $sectionManager->getId()));
     $sectionManager->delete(array('id' => $sectionManager->getId()));
 }
Beispiel #2
0
 public function removeSection(Section $section)
 {
     $count = count($this->sections);
     $id = $section->getId();
     for ($i = 0; $i < $count; $i++) {
         if ($this->sections[$i]->getId() === $id) {
             array_splice($this->sections, $i, 1);
             $i--;
             $count--;
         }
     }
     return $this;
 }
Beispiel #3
0
 public function update(Section $section)
 {
     $this->updateObject('Section', 's_id', $section->getId(), ['u_id' => $section->getUserId(), 's_supe' => $section->getParentId(), 's_name' => $section->getName()]);
 }
Beispiel #4
0
<?php

require_once 'KodiCmd.class.php';
$table = new KodiCmd();
$table->create();
$s1 = new Section();
$s1->setLabel('kodi');
$s1->save();
$r1 = new Right();
$r1->setSection($s1->getId());
$r1->setRead('1');
$r1->setDelete('1');
$r1->setCreate('1');
$r1->setUpdate('1');
$r1->setRank('1');
$r1->save();
$conf = new Configuration();
$conf->put('plugin_kodiCmd_api_url_kodi', 'http://192.168.1.107:85/jsonrpc');
$conf->put('plugin_kodiCmd_api_timeout_kodi', 5);
$conf->put('plugin_kodiCmd_api_recognition_status', '');
$ro = new Room();
$ro->setName('KODI');
$ro->setDescription('De la bonne zic, un bon p\'tit film....');
$ro->save();
$roomManager = new Room();
$rooms = $roomManager->populate();
foreach ($rooms as $room) {
    if ($room->getName() == "KODI") {
        $kodiRoomId = $room->getId();
    }
}
Beispiel #5
0
 /**
  * Save section.
  */
 function execute()
 {
     $journal =& Request::getJournal();
     $journalId = $journal->getId();
     $sectionDao =& DAORegistry::getDAO('SectionDAO');
     if (isset($this->sectionId)) {
         $section =& $sectionDao->getSection($this->sectionId, $journalId);
     }
     if (!isset($section)) {
         $section = new Section();
         $section->setJournalId($journalId);
         $section->setSequence(REALLY_BIG_NUMBER);
     }
     $section->setTitle($this->getData('title'), null);
     // Localized
     $section->setAbbrev($this->getData('abbrev'), null);
     // Localized
     $reviewFormId = $this->getData('reviewFormId');
     if ($reviewFormId === '') {
         $reviewFormId = null;
     }
     $section->setReviewFormId($reviewFormId);
     $section->setMetaIndexed($this->getData('metaIndexed') ? 0 : 1);
     // #2066: Inverted
     $section->setMetaReviewed($this->getData('metaReviewed') ? 0 : 1);
     // #2066: Inverted
     $section->setAbstractsNotRequired($this->getData('abstractsNotRequired') ? 1 : 0);
     $section->setIdentifyType($this->getData('identifyType'), null);
     // Localized
     $section->setEditorRestricted($this->getData('editorRestriction') ? 1 : 0);
     $section->setHideTitle($this->getData('hideTitle') ? 1 : 0);
     $section->setHideAuthor($this->getData('hideAuthor') ? 1 : 0);
     $section->setHideAbout($this->getData('hideAbout') ? 1 : 0);
     $section->setDisableComments($this->getData('disableComments') ? 1 : 0);
     $section->setPolicy($this->getData('policy'), null);
     // Localized
     $section->setAbstractWordCount($this->getData('wordCount'));
     if ($section->getId() != null) {
         $sectionDao->updateSection($section);
         $sectionId = $section->getId();
     } else {
         $sectionId = $sectionDao->insertSection($section);
         $sectionDao->resequenceSections($journalId);
     }
     // Save assigned editors
     $assignedEditorIds = Request::getUserVar('assignedEditorIds');
     if (empty($assignedEditorIds)) {
         $assignedEditorIds = array();
     } elseif (!is_array($assignedEditorIds)) {
         $assignedEditorIds = array($assignedEditorIds);
     }
     $sectionEditorsDao =& DAORegistry::getDAO('SectionEditorsDAO');
     $sectionEditorsDao->deleteEditorsBySectionId($sectionId, $journalId);
     foreach ($this->sectionEditors as $key => $junk) {
         $sectionEditor =& $this->sectionEditors[$key];
         $userId = $sectionEditor->getId();
         // We don't have to worry about omit- and include-
         // section editors because this function is only called
         // when the Save button is pressed and those are only
         // used in other cases.
         if (in_array($userId, $assignedEditorIds)) {
             $sectionEditorsDao->insertEditor($journalId, $sectionId, $userId, Request::getUserVar('canReview' . $userId), Request::getUserVar('canEdit' . $userId));
         }
         unset($sectionEditor);
     }
 }
 /**
  * Declares an association between this object and a Section object.
  *
  * @param      Section $v
  * @return     SectionHasItem The current object (for fluent API support)
  * @throws     PropelException
  */
 public function setSection(Section $v = null)
 {
     // aggregate_column_relation behavior
     if (null !== $this->aSection && $v !== $this->aSection) {
         $this->oldSection = $this->aSection;
     }
     if ($v === null) {
         $this->setSectionId(NULL);
     } else {
         $this->setSectionId($v->getId());
     }
     $this->aSection = $v;
     // Add binding for other direction of this n:n relationship.
     // If this object has already been added to the Section object, it will not be re-added.
     if ($v !== null) {
         $v->addSectionHasItem($this);
     }
     return $this;
 }
Beispiel #7
0
 $configuration->put('PROGRAM_VERSION', '3.0.6');
 $configuration->put('HOME_PAGE', 'index.php');
 $configuration->put('VOCAL_SENSITIVITY', '0.0');
 //Création du rang admin
 $rank = new Rank();
 $rank->setLabel('admin');
 $rank->save();
 //Déclaration des sections du programme
 $sections = array('event', 'vocal', 'user', 'plugin', 'configuration', 'admin');
 //Création des sections déclarées et attribution de tous les droits sur toutes ces sections pour l'admin
 foreach ($sections as $sectionName) {
     $s = new Section();
     $s->setLabel($sectionName);
     $s->save();
     $r = new Right();
     $r->setSection($s->getId());
     $r->setRead('1');
     $r->setDelete('1');
     $r->setCreate('1');
     $r->setUpdate('1');
     $r->setRank($rank->getId());
     $r->save();
 }
 $personalities = array('John Travolta', 'Jeff Buckley', 'Tom Cruise', 'John Lennon', 'Emmet Brown', 'Geo trouvetou', 'Luke Skywalker', 'Mac Gyver', 'Marty McFly');
 $im = $personalities[rand(0, count($personalities) - 1)];
 list($fn, $n) = explode(' ', $im);
 //Creation du premier compte et assignation en admin
 $user->setMail($_POST['email']);
 $user->setPassword($_POST['password']);
 $user->setLogin($_POST['login']);
 $user->setFirstName($fn);
*/
require_once 'Sensor.class.php';
$table = new Sensor();
$table->create();
require_once 'SensorType.class.php';
$table2 = new SensorType();
$table2->create();
$s1 = new Section();
$s1->setLabel('sensor');
$s1->save();
$s2 = new Section();
$s2->setLabel('sensortypes');
$s2->save();
$r1 = new Right();
$r1->setSection($s1->getId());
$r1->setRead('1');
$r1->setDelete('1');
$r1->setCreate('1');
$r1->setUpdate('1');
$r1->setRank('1');
$r1->save();
$r2 = new Right();
$r2->setSection($s2->getId());
$r2->setRead('1');
$r2->setDelete('1');
$r2->setCreate('1');
$r2->setUpdate('1');
$r2->setRank('1');
$r2->save();
$conf = new Configuration();
$conf->put('plugin_sensor_receptor_pin', '0');
Beispiel #9
0
 /**
  * Save section.
  */
 function execute()
 {
     $journal =& Request::getJournal();
     $journalId = $journal->getId();
     $sectionDao =& DAORegistry::getDAO('SectionDAO');
     if (isset($this->sectionId)) {
         $section =& $sectionDao->getSection($this->sectionId, $journalId);
     }
     if (!isset($section)) {
         $section = new Section();
         $section->setJournalId($journalId);
         $section->setSequence(REALLY_BIG_NUMBER);
     }
     $section->setTitle($this->getData('title'), null);
     // Localized
     $section->setAbbrev($this->getData('abbrev'), null);
     // Localized
     // Added region
     // EL on Febraurt 11th 2013
     $section->setRegion($this->getData('region'), null);
     $reviewFormId = $this->getData('reviewFormId');
     if ($reviewFormId === '') {
         $reviewFormId = null;
     }
     $section->setReviewFormId($reviewFormId);
     $section->setMetaIndexed($this->getData('metaIndexed') ? 0 : 1);
     // #2066: Inverted
     $section->setMetaReviewed($this->getData('metaReviewed') ? 0 : 1);
     // #2066: Inverted
     $section->setAbstractsNotRequired($this->getData('abstractsNotRequired') ? 1 : 0);
     $section->setIdentifyType($this->getData('identifyType'), null);
     // Localized
     $section->setEditorRestricted($this->getData('editorRestriction') ? 1 : 0);
     $section->setHideTitle($this->getData('hideTitle') ? 1 : 0);
     $section->setHideAuthor($this->getData('hideAuthor') ? 1 : 0);
     $section->setHideAbout($this->getData('hideAbout') ? 1 : 0);
     $section->setDisableComments($this->getData('disableComments') ? 1 : 0);
     $section->setPolicy($this->getData('policy'), null);
     // Localized
     $section->setAbstractWordCount($this->getData('wordCount'));
     if ($section->getId() != null) {
         $sectionDao->updateSection($section);
         $sectionId = $section->getId();
     } else {
         $sectionId = $sectionDao->insertSection($section);
         $sectionDao->resequenceSections($journalId);
     }
 }
 /**
  * Exclude object from result
  *
  * @param     Section $section Object to remove from the list of results
  *
  * @return    SectionQuery The current query, for fluid interface
  */
 public function prune($section = null)
 {
     if ($section) {
         $this->addUsingAlias(SectionPeer::ID, $section->getId(), Criteria::NOT_EQUAL);
     }
     return $this;
 }
 /**
  * Filter the query by a related Section object
  *
  * @param     Section|PropelCollection $section The related object(s) to use as filter
  * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
  *
  * @return    SectionHasItemQuery The current query, for fluid interface
  */
 public function filterBySection($section, $comparison = null)
 {
     if ($section instanceof Section) {
         return $this->addUsingAlias(SectionHasItemPeer::SECTION_ID, $section->getId(), $comparison);
     } elseif ($section instanceof PropelCollection) {
         if (null === $comparison) {
             $comparison = Criteria::IN;
         }
         return $this->addUsingAlias(SectionHasItemPeer::SECTION_ID, $section->toKeyValue('PrimaryKey', 'Id'), $comparison);
     } else {
         throw new PropelException('filterBySection() only accepts arguments of type Section or PropelCollection');
     }
 }