コード例 #1
0
ファイル: actions.class.php プロジェクト: yasirgit/afids
 function executeNotification(sfWebRequest $request)
 {
     $c = new Criteria();
     $c->addAscendingOrderByColumn(RolePeer::TITLE);
     $this->role_list = RolePeer::doSelect($c);
     /////////////////////////////////////////
     $c = new Criteria();
     $c->addAscendingOrderByColumn(RoleNotificationPeer::MID);
     $this->notification_list = RoleNotificationPeer::doSelectJoinAll($c);
     //////////////////////////////////////////
 }
コード例 #2
0
ファイル: actions.class.php プロジェクト: yasirgit/afids
    function executeAddrole(sfWebRequest $request)
    {
        /*$c = new Criteria();
            $c->add(RoleNotificationPeer::ID, $request->getParameter('rnid'));
            RoleNotificationPeer::doDelete($c);	
        	*/
        if (!$this->getUser()->hasCredential(array('Administrator'), false)) {
            $this->getUser()->setFlash("warning", 'You don\'t have permission to access this url ' . $request->getReferer());
            $this->redirect('dashboard/index');
        }
        $isEmail = $request->getParameter('isemail');
        $isInstrument = $request->getParameter('isinstrument');
        $roleId = $request->getParameter('roleid');
        $misType = $request->getParameter('mistype');
        $divname = $request->getParameter('divname');
        $c = new Criteria();
        $c->add(RoleNotificationPeer::ROLE_ID, $roleId);
        $c->add(RoleNotificationPeer::MID, $misType);
        $role = RoleNotificationPeer::doSelect($c);
        $last_id = "";
        if (count($role) == 0) {
            $rolenotification = new RoleNotification();
            $rolenotification->setMid($misType);
            $rolenotification->setRoleId($roleId);
            $rolenotification->setNotification($this->getNotification($isEmail, $isInstrument));
            $rolenotification->save();
            $last_id = $rolenotification->getId();
        }
        if (strlen($last_id) > 0) {
            $c = new Criteria();
            $c->add(RoleNotificationPeer::ID, $last_id);
            $notification = RoleNotificationPeer::doSelectJoinAll($c);
            foreach ($notification as $nod) {
                /////////////////////////
                if ($nod->getNotification() == "3") {
                    $email = "checked";
                    $instnel = "checked";
                } else {
                    if ($nod->getNotification() == "2") {
                        $email = "";
                        $instnel = "checked";
                    } else {
                        if ($nod->getNotification() == "1") {
                            $email = "checked";
                            $instnel = "";
                        } else {
                            $email = "";
                            $instnel = "";
                        }
                    }
                }
                /////////////////////////
                $str = '<div id="rolid' . $last_id . '">' . '<table><tr><td width="' . '200' . '">' . $nod->getRole()->getTitle() . '&nbsp;<span onclick="delRole(' . $nod->getId() . ')" style="cursor:pointer;color:red;"><b>X</b></span>
							&nbsp;&nbsp;&nbsp;<span>' . '</td><td>' . '<input name="isEmail" id="isEmail" value="1" type="checkbox" ' . $email . ' /> Email<input name="isInstrumental" id="isInstrumental" value="1" type="checkbox" ' . $instnel . ' /> Instrument Panel' . '<a href="#" class="link-edit" onclick="editrole(' . $nod->getId() . ',' . '"$divname"' . '); return false;" />Edit</a>' . '</td><tr></table>' . '</div>' . '<div id="' . $divname . '">' . '</div>';
            }
            return $this->renderText($str);
        } else {
            return $this->renderText("1");
        }
        //1 for unsuccess
    }