Exemplo n.º 1
0
 /**
  * update record
  *
  * @param App_Shopstatusrecord_Dm $dm
  * @return multitype:|Ambigous <boolean, number, rowCount>
  */
 public function update($id, App_Shoparea_Dm $dm)
 {
     if (true !== ($r = $dm->beforeUpdate())) {
         return $r;
     }
     return $this->loadDao()->update($id, $dm->getData());
 }
Exemplo n.º 2
0
 public function run()
 {
     $this->_setNavType('shoparea');
     $allSchool = $this->_get4TSchoolDS()->getOpenedSchools();
     $allSchool = array_values($allSchool);
     $countschool = count($allSchool);
     if ($this->getInput('search', 'post') === 'search') {
         list($shopId) = $this->getInput(array('shopId'), 'post');
     } elseif ($this->getInput('save', 'post') === 'save') {
         list($shopId) = $this->getInput(array('hiddenshopid'), 'post');
         list($shop) = $this->getInput(array('shop'), 'post');
         list($shopareaid) = $this->getInput(array('shopareaid'), 'post');
         list($schoolid) = $this->getInput(array('schoolid'), 'post');
         for ($i = 0; $i < $countschool; $i++) {
             $dm = new App_Shoparea_Dm();
             $dm->setShopId($shopId)->setSchoolId($schoolid[$i]);
             if ($shopareaid[$i] > 0) {
                 if (!$shop[$i]) {
                     $delstatus = $this->_getShopAreaDs()->deleteShopAreaById($shopareaid[$i]);
                 }
             } else {
                 if ($shop[$i]) {
                     $addstatus = $this->_getShopAreaDs()->add($dm);
                 }
             }
         }
         if ($delstatus || $addstatus) {
             $this->showMessage("更新成功");
         }
     } else {
         list($shopId) = $this->getInput(array('shopId'), 'get');
     }
     $shopMsg = $this->_getShopDs()->getByShopId($shopId);
     foreach ($allSchool as $key => $value) {
         $shoparea = $this->_getShopAreaDs()->checkShopIfExist($value['schoolid'], $shopId);
         $allSchool[$key]['shopareaid'] = $shoparea[0]['id'];
         $allSchool[$key]['status'] = count($shoparea) > 0 ? "1" : "0";
         $allSchool[$key]['shopname'] = $shopMsg['name'];
     }
     $this->setOutput($shopId, 'shopId');
     $this->setOutput($shopMsg, 'shopMsg');
     $this->setOutput($allSchool, 'allSchool');
 }
Exemplo n.º 3
0
 public function saveShopSchool($shopId, $schoolId)
 {
     $dm = new App_Shoparea_Dm();
     $dm->setShopId($shopId)->setSchoolId($schoolId);
     $id = $this->_getShopAreaDs()->add($dm);
     return $id;
 }