示例#1
0
 public function getDefaultQuota(Nette\Security\User $user)
 {
     $quota = '100G';
     if ($user->isInRole('SO') || $user->isInRole('ZSO') || $user->isInRole('VV')) {
         $quota = '3T';
     }
     $quotaNumeric = ByteHelper::humanToBytes($quota);
     return $quotaNumeric;
 }
示例#2
0
 public function slozkaEditFormSucceeded(Form $form, $values)
 {
     $size = ByteHelper::humanToBytes($values->size);
     if (empty($values->size) || $size == 0) {
         $size = NULL;
     }
     if (empty($values->id)) {
         $this->sm->createUserFolder($values->name, $size, $values->comment);
     } else {
         //$id = $values->id;
         //$this->uzivatel->find($id)->update($values);
         //$this->log->l('uzivatel.edit', $id);
     }
     $this->flashMessage('Složka byla úspěšně uložena.', 'success');
     $this->redirect('Slozky:');
 }
示例#3
0
 public function renderEdit($id)
 {
     $f = $this->folder->find($id);
     if (!$f) {
         $this->error("Složka s daným ID neexistuje.");
     }
     if (ByteHelper::getDegree($f->name) == 1) {
         $this->error("Základní složku uživatele nelze sdílet.");
     }
     $defaults["folder_id"] = $id;
     $s = $this->share->findOneBy(array('folder_id' => $id, 'shareType_id' => self::shareType_id));
     if ($s) {
         $defaults["id"] = $s->id;
         $defaults["ips"] = $s->var;
         $defaults["export"] = true;
     }
     $this['nfsEditForm']->setDefaults($defaults);
     //$this->template->osoba = $u;
     $this->template->slozka = $f->name;
     $this->template->nfsurl = "nas.hkfree.org:" . Model\Share::dataBaseUrl . $f->name . "/";
 }
示例#4
0
 public function renderEdit($id)
 {
     $f = $this->folder->find($id);
     if (!$f) {
         $this->error("Složka s daným ID neexistuje.");
     }
     if (ByteHelper::getDegree($f->name) == 1) {
         $this->error("Základní složku uživatele nelze sdílet.");
     }
     $defaults["folder_id"] = $id;
     $s = $this->share->findOneBy(array('folder_id' => $id, 'shareType_id' => self::shareType_id));
     if ($s) {
         $defaults["id"] = $s->id;
         $defaults["username"] = $s->var;
         $defaults["password"] = $s->var2;
         $defaults["export"] = true;
     }
     $this['ftpEditForm']->setDefaults($defaults);
     $this->template->slozka = $f->name;
     //$this->template->osoba = $u;
     $this->template->ftpurl = "ftp://nas.hkfree.org/";
 }