public function groupAction() { $schoolid = $this->getInput('schoolid', 'get'); if (!isset($schoolid) || $schoolid <= 0) { $this->showError("无效的学校"); } $type = $this->getInput('type', 'get'); if (!isset($type) || $type == '') { $this->showError("无效的类型参数,例如delivery,master"); } $this->setOutput($schoolid, "schoolid"); $this->setOutput($type, "type"); $this->setOutput($typename, "typename"); if ("addGroup" == $this->getInput("addGroup")) { $groupName = $this->getInput("groupname"); if (empty($groupName)) { $this->showError("组名不能为空"); } $leaderId = $this->getInput("leader"); if ($leaderId <= 0) { $this->showError("必须选择一个组长"); } //check 重复项 $exists = $this->_getSchoolGroupDS()->checkIfExists($schoolid, $groupName, $type, 0); $message = "不能添加重复项"; if ($exists) { $this->showError($message); } //add the group and leader Wind::import('EXT:4tschool.service.schoolgroup.dm.App_SchoolGroup_Dm'); $dm = new App_SchoolGroup_Dm(); $dm->setSchool($schoolid)->setName($groupName)->setLeaderId($leaderId)->setType($type); $this->_getSchoolGroupDS()->addSchoolGroup($dm); } if ("deleteSelected" == $this->getInput("deleteSelected")) { $checkedItems = $this->getInput("checkItem"); $itemArray = $this->getInput("eachItem"); foreach ($checkedItems as $checkKey => $checkValue) { if ($checkValue) { $id = $checkValue; //delete based on id $this->_getSchoolGroupDS()->delete($id); } } } //get school information $schoolInfo = $this->_getSchoolDs()->getSchool($schoolid); $this->setOutput($schoolInfo, "schoolInfo"); $ppls = $this->_getSchoolPeopleDS()->getSchoolPeople($schoolid, 'delivery'); $this->setOutput($ppls, "ppls"); //get school group $groups = $this->_getSchoolGroupDS()->getSchoolGroup($schoolid, 'delivery'); $this->setOutput($groups, 'groups'); }
public function addSchoolGroup(App_SchoolGroup_Dm $dm) { return $this->_loadDao()->add($dm->getData()); }