Commits

Tim Gerrits committed f067aaa

changed wv9 to service abd groupID tp groupName

  • Participants
  • Parent commits 7574bc6

Comments (0)

Files changed (2)

File lib/sly/Controller/Translator.php

 		$this->action = 'edit';
 
 		$unitID  = sly_get('unit', 'string');
-		$groupID = 0;
+		$groupName = 0;
 		$unit = $this->service->findByIdent($unitID);
 
 		if (!$unit) {
 			return $this->indexAction();
 		}
 
-		$this->render('form.phtml', compact('unit', 'groupID', 'unitID'), false);
+		$this->render('form.phtml', compact('unit', 'groupName', 'unitID'), false);
 	}
 
 	public function do_editAction() {
 
 		$unitID = sly_get('unit', 'int');
 
-		if (!$this->wv9->unitExists($unitID)) {
+		if (!$this->service->unitExists($unitID)) {
 			print sly_Helper_Message::warn(t('translator_error_unknown_unit'));
 			return $this->indexAction();
 		}
 
-		$this->wv9->removeUnit($unitID);
-		$this->wv9->update();
+		$this->service->removeUnit($unitID);
+		$this->service->update();
 
 		print sly_Helper_Message::info(t('translator_info_unit_removed'));
 		$this->indexAction();
 		$this->init();
 		if ($this->stop('addunit')) return;
 
-		$groupID = sly_get('group', 'string');
+		$groupName = sly_get('group', 'string');
 
-		if (!$this->service->groupExists($groupID)) {
+		if (!$this->service->groupExists($groupName)) {
 			print sly_Helper_Message::warn(t('translator_error_unknown_group'));
 			return $this->indexAction();
 		}
 		$unitID = -1;
 		$unit   = null;
 
-		$this->render('form.phtml', compact('unit', 'unitID', 'groupID'), false);
+		$this->render('form.phtml', compact('unit', 'unitID', 'groupName'), false);
 	}
 
 	public function do_addunitAction() {
 		$this->init();
 		if ($this->stop('addunit')) return;
 
-		$groupID = sly_get('group', 'int');
+		$groupName = sly_get('group', 'int');
 
-		if (!$this->wv9->groupExists($groupID)) {
+		if (!$this->service->groupExists($groupName)) {
 			print sly_Helper_Message::warn(t('translator_error_unknown_group'));
 			return $this->indexAction();
 		}
 		// Fertig!
 
 		try {
-			$this->wv9->addUnit($groupID, $source, $targets);
-			$this->wv9->update();
+			$this->service->addUnit($groupName, $source, $targets);
+			$this->service->update();
 		}
 		catch (Exception $e) {
 			print sly_Helper_Message::warn($e->getMessage());

File views/form.phtml

  */
 
 $func    = $this->action;
-$action  = 'index.php?page=translator&func=do_'.$func.'&unit='.$unitID.'&group='.$groupID;
+$action  = 'index.php?page=translator&func=do_'.$func.'&unit='.$unitID.'&group='.$groupName;
 $form    = new sly_Form($action, 'POST', t('translator_form_'.str_replace(array('do_', 'unit'), '', $func).'_element'), '', 'wv9-unit');
 $canSet  = $this->isManager();
 $langs   = sly_Util_Language::findAll();