Ejemplo n.º 1
0
 protected function createSelectionEntry($areSelEnabled)
 {
     $sel = $areSelEnabled ? '1' : '0';
     $selection = new \Babesk\ORM\SystemGlobalSettings();
     $selection->setName('elawaSelectionsEnabled')->setValue($sel);
     $this->_em->persist($value);
     $this->_em->flush();
 }
Ejemplo n.º 2
0
 public function setSetting($name, $value)
 {
     try {
         $entry = $this->_em->findOneByName($name);
         if (!$entry) {
             $entry = new \Babesk\ORM\SystemGlobalSettings();
             $entry->setName($name);
         }
         $entry->setValue($value);
         $this->_em->persist($entry);
         $this->_em->flush();
         return true;
     } catch (\Exception $e) {
         $this->_em->getRepository('DM:SystemLog')->log('Error setting a GlobalSetting', 'error', 'Repository\\GlobalSetting', ['name' => $name, 'value' => $value]);
         return false;
     }
 }
Ejemplo n.º 3
0
 private function shouldGenerateSchbasAssignmentsSet($status)
 {
     $schbasAssignmentsEntry = $this->_em->getRepository('DM:SystemGlobalSettings')->findOneByName('userUpdateWithSchoolyearChangeSchbasAssignmentsGenerate');
     if (!$schbasAssignmentsEntry) {
         $schbasAssignmentsEntry = new \Babesk\ORM\SystemGlobalSettings();
         $schbasAssignmentsEntry->setName('userUpdateWithSchoolyearChangeSchbasAssignmentsGenerate');
     }
     $schbasAssignmentsEntry->setValue($status ? 1 : 0);
     $this->_em->persist($schbasAssignmentsEntry);
 }
Ejemplo n.º 4
0
 protected function maintenance()
 {
     $entry = $this->_em->getRepository('DM:SystemGlobalSettings')->findOneByName('siteIsUnderMaintenance');
     if ($entry) {
         $val = $entry->getValue();
     } else {
         // Global Setting does not exist; create it
         $setting = new \Babesk\ORM\SystemGlobalSettings();
         $setting->setName('siteIsUnderMaintenance');
         $setting->setValue(0);
         $this->_em->persist($setting);
         $this->_em->flush();
         $val = $setting->getValue();
     }
     $this->_smarty->assign('maintenance', $val);
     $this->displayTpl('maintenance.tpl');
     //$this->_interface->maintenance($val);
 }
Ejemplo n.º 5
0
 /**
  * Returns the schoolyear for which schbas is getting prepared
  * @return \Babesk\ORM\SystemSchoolyears on success or a false value
  */
 public function schbasPreparationSchoolyearGet()
 {
     $sySetting = $this->_em->getRepository('DM:SystemGlobalSettings')->findOneByName('schbasPreparationSchoolyearId');
     //Add entry if not existing
     if (!$sySetting) {
         $sySetting = new \Babesk\ORM\SystemGlobalSettings();
         $sySetting->setName('schbasPreparationSchoolyearId');
         $sySetting->setValue('');
         $this->_em->persist($sySetting);
         $this->_em->flush();
     }
     $syEntry = $this->_em->getRepository('DM:SystemSchoolyears')->findOneById($sySetting->getValue());
     return $syEntry;
 }