예제 #1
0
function doDelete()
{
    @($id = $_POST['selector']);
    $key = count($id);
    //multi delete using checkbox as a selector
    for ($i = 0; $i < $key; $i++) {
        $dept = new Dept();
        $dept->delete($id[$i]);
    }
    message("Department name(s) already Deleted!", "info");
    redirect('index.php');
}
예제 #2
0
 /**
  * Authenticates a user.
  * The example implementation makes sure if the username and password
  * are both 'demo'.
  * In practical applications, this should be changed to authenticate
  * against some persistent user identity storage (e.g. database).
  * @return boolean whether authentication succeeds.
  */
 public function authenticate()
 {
     $dept_id = $this->user !== NULL ? Users::model()->getDeptId($this->user->id) : NULL;
     if ($this->user === null) {
         $this->errorCode = self::ERROR_USERNAME_INVALID;
     } else {
         if ($this->user->validatePassword($this->password)) {
             $this->errorCode = self::ERROR_PASSWORD_INVALID;
         } else {
             if ($this->user->status === Users::STATUS_BLOCKED) {
                 $this->errorCode = self::ERROR_ACC_BLOCKED;
             } else {
                 if ($this->user->status === Users::STATUS_PENDING) {
                     $this->errorCode = self::ERROR_ACC_PENDING;
                 } else {
                     if (!empty($dept_id) && Dept::model()->get($dept_id, 'status') === Dept::STATUS_CLOSED) {
                         $this->errorCode = self::ERROR_DEPT_CLOSED;
                     } else {
                         $this->completeLogin($dept_id);
                     }
                 }
             }
         }
     }
     return $this->errorCode === self::ERROR_NONE;
 }
예제 #3
0
 public function actionIndex()
 {
     $this->hasPrivilege(Acl::ACTION_VIEW);
     $this->pageTitle = Lang::t(Common::pluralize($this->resourceLabel));
     $searchModel = Dept::model()->searchModel(array(), $this->settings[Constants::KEY_PAGINATION], 'name');
     $this->render('default/index', array('model' => $searchModel));
 }
예제 #4
0
 function getDept()
 {
     if (!$this->dept && $this->getDeptId()) {
         $this->dept = Dept::lookup($this->getDeptId());
     }
     return $this->dept;
 }
예제 #5
0
 public function actionDelete($id)
 {
     $this->hasPrivilege(Acl::ACTION_DELETE);
     Dept::model()->loadModel($id)->delete();
     if (!Yii::app()->request->isAjaxRequest) {
         $this->redirect(isset($_POST['returnUrl']) ? $_POST['returnUrl'] : array('index'));
     }
 }
 public function actionDynamicRows()
 {
     $selectionid = $_POST['selection'];
     $depts = Dept::model()->findAllByAttributes(array('orgid' => $selectionid));
     foreach ($depts as $row) {
         $dataOptions[$row->id] = $row->name;
     }
     foreach ($dataOptions as $value => $name) {
         $opt = array();
         $opt['value'] = $value;
         echo CHtml::tag('option', $opt, CHtml::encode($name), true);
     }
     die;
 }
 public function actionGetDeptInfo()
 {
     $this->retVal = new stdClass();
     $request = Yii::app()->request;
     if ($request->isPostRequest && isset($_POST)) {
         try {
             $faculty_id = $request->getPost('faculty_id');
             $dept_id = $request->getPost('dept_id');
             $dept_data = Dept::model()->findAllByAttributes(array('dept_id' => $dept_id, 'dept_faculty' => $faculty_id));
             $this->retVal->dept_data = $dept_data;
         } catch (exception $e) {
             $this->retVal->message = $e->getMessage();
         }
         echo CJSON::encode($this->retVal);
         Yii::app()->end();
     }
 }
예제 #8
0
 /**
  * Declares an association between this object and a Dept object.
  *
  * @param      Dept $v
  * @return     DeptMetadata The current object (for fluent API support)
  * @throws     PropelException
  */
 public function setDept(Dept $v = null)
 {
     if ($v === null) {
         $this->setDeptBId(NULL);
     } else {
         $this->setDeptBId($v->getBId());
     }
     $this->aDept = $v;
     // Add binding for other direction of this n:n relationship.
     // If this object has already been added to the Dept object, it will not be re-added.
     if ($v !== null) {
         $v->addDeptMetadata($this);
     }
     return $this;
 }
예제 #9
0
 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate($dept_id = NULL, $user_level = NULL)
 {
     $this->hasPrivilege(Acl::ACTION_CREATE);
     $this->pageTitle = Lang::t('Add ' . $this->resourceLabel);
     //account information
     $user_model = new Users(ActiveRecord::SCENARIO_CREATE);
     $user_model->status = Users::STATUS_ACTIVE;
     $user_model_class_name = $user_model->getClassName();
     //personal information
     $person_model = new Person();
     $person_model_class_name = $person_model->getClassName();
     if (Yii::app()->request->isPostRequest) {
         $user_model->attributes = $_POST[$user_model_class_name];
         $person_model->attributes = $_POST[$person_model_class_name];
         $user_model->validate();
         $person_model->validate();
         if (!$user_model->hasErrors() && !$person_model->hasErrors()) {
             if ($user_model->save(FALSE)) {
                 $person_model->id = $user_model->id;
                 $person_model->save(FALSE);
                 $user_model->updateDeptUser();
                 if (!empty($user_model->dept_id)) {
                     Dept::model()->updateContactPerson($user_model->dept_id, $person_model->id);
                 }
                 Yii::app()->user->setFlash('success', Lang::t('SUCCESS_MESSAGE'));
                 $this->redirect(Controller::getReturnUrl($this->createUrl('view', array('id' => $user_model->id))));
             }
         }
     }
     $user_model->timezone = Yii::app()->settings->get(Constants::CATEGORY_GENERAL, Constants::KEY_DEFAULT_TIMEZONE, SettingsTimezone::DEFAULT_TIME_ZONE);
     if (!empty($dept_id)) {
         $user_model->dept_id = $dept_id;
     }
     if (!empty($user_level)) {
         $user_model->user_level = $user_level;
     }
     $this->render('create', array('user_model' => $user_model, 'person_model' => $person_model));
 }
예제 #10
0
 /**
  *@author: wawan
  *@return relational database Departement
  */
 public function getDept()
 {
     return $this->hasOne(Dept::className(), ['DEP_ID' => 'KD_DEP']);
 }
예제 #11
0
         if ($ticket->isClosed() && $wasOpen) {
             $ticket = null;
         }
     } elseif (!$errors['err']) {
         $errors['err'] = 'Unable to post the reply. Correct the errors below and try again!';
     }
     break;
 case 'transfer':
     /** Transfer ticket **/
     //Check permission
     if ($thisstaff && $thisstaff->canTransferTickets()) {
         if (!$_POST['deptId']) {
             $errors['deptId'] = 'Select department';
         } elseif ($_POST['deptId'] == $ticket->getDeptId()) {
             $errors['deptId'] = 'Ticket already in the Dept.';
         } elseif (!($dept = Dept::lookup($_POST['deptId']))) {
             $errors['deptId'] = 'Unknown or invalid department';
         }
         if (!$_POST['transfer_message']) {
             $errors['transfer_message'] = 'Transfer comments/notes required';
         } elseif (strlen($_POST['transfer_message']) < 5) {
             $errors['transfer_message'] = 'Transfer comments too short!';
         }
         $currentDept = $ticket->getDeptName();
         //save current dept name.
         if (!$errors && $ticket->transfer($_POST['deptId'], $_POST['transfer_message'])) {
             $msg = 'Ticket transferred successfully to ' . $ticket->getDeptName();
             //ticket->transfer does a reload...new dept at this point.
             $title = 'Dept. Transfer from ' . $currentDept . ' to ' . $ticket->getDeptName();
             /*** log the message as internal note - with alerts disabled - ***/
             $ticket->postNote($title, $_POST['transfer_message'], false);
예제 #12
0
?>
</a>
            </th>
            <th width="120">
                Localizador
            </th>
            <th width="120">
                Status
            </th>
        </tr>
    </thead>
    <tbody>
    <?php 
$subject_field = TicketForm::objects()->one()->getField('subject');
if ($res && ($num = db_num_rows($res))) {
    $defaultDept = Dept::getDefaultDeptName();
    //Default public dept.
    while ($row = db_fetch_array($res)) {
        $dept = $row['ispublic'] ? $row['dept_name'] : $defaultDept;
        $subject = Format::truncate($subject_field->display($subject_field->to_php($row['subject']) ?: $row['subject']), 40);
        if ($row['attachments']) {
            $subject .= '  &nbsp;&nbsp;<span class="Icon file"></span>';
        }
        $ticketNumber = $row['number'];
        if ($row['isanswered'] && !strcasecmp($row['state'], 'open')) {
            $subject = "<b>{$subject}</b>";
            $ticketNumber = "<b>{$ticketNumber}</b>";
        }
        ?>
            <tr id="<?php 
        echo $row['ticket_id'];
예제 #13
0
     border-color: #d0d6d9;
     ">

    <h3 id="second">Các ngành học</h3>            
    <div class="widget">
        <nav class="w-nav">
            <div class="w-nav-h">
                <div class="w-nav-list layout_ver level_1">
                    <div class="w-nav-list-h">
                        <?php 
foreach ($category_father as $category) {
    ?>
                            <div class="w-nav-item level_1 active">

                                <?php 
    $dept = Dept::model()->findAllByAttributes(array('dept_faculty' => $category->faculty_id));
    ?>
                                <div class="w-nav-item-h">
                                    <a href="#faculty-<?php 
    echo $category->faculty_id;
    ?>
" class="w-nav-anchor level_1 faculty" faculty-id="<?php 
    echo $category->faculty_id;
    ?>
"><?php 
    echo $category->faculty_name;
    ?>
 
                                        <span class="w-nav-title " ></span>
                                    </a>
예제 #14
0
파일: admin.php 프로젝트: hungnv0789/vhtm
                        $staff=null;
                        $errors['err']='Unable to fetch info on rep ID#'.$id;
                    }
                }
                $page=($staff or ($_REQUEST['a']=='new' && !$uID))?'staff.inc.php':'staffmembers.inc.php';
                break;
            default:
                $page='staffmembers.inc.php';
        }
        break;
    //Departments
    case 'dept': //lazy
    case 'depts':
        $dept=null;
        if(($id=$_REQUEST['id']?$_REQUEST['id']:$_POST['dept_id']) && is_numeric($id)) {
            $dept= new Dept($id);
            if(!$dept || !$dept->getId()) {
                $dept=null;
                $errors['err']='Unable to fetch info on Dept ID#'.$id;
            }
        }
        $page=($dept or ($_REQUEST['a']=='new' && !$deptID))?'dept.inc.php':'depts.inc.php';
        $nav->setTabActive('depts');
        $nav->addSubMenu(array('desc'=>'Departments','href'=>'admin.php?t=depts','iconclass'=>'departments'));
        $nav->addSubMenu(array('desc'=>'Add New Dept.','href'=>'admin.php?t=depts&a=new','iconclass'=>'newDepartment'));
        break;
    // (default)
    default:
        $page='pref.inc.php';
}
//========================= END ADMIN PAGE LOGIC ==============================//
예제 #15
0
if (trim($labelParams['fileType']) != '') {
    $fileType = $labelParams['fileType'];
    $filetypeRow = FileType::model()->findByAttributes(array('id' => $fileType));
} else {
    $filetypeRow['label_width'] = 400;
    $filetypeRow['label_height'] = 100;
}
$label_width = (int) $filetypeRow['label_width'] . 'px';
$label_height = (int) $filetypeRow['label_height'] . 'px';
$paper = $labelParams['paper'];
$numColumns = floor($paperWidth / $filetypeRow['label_width']);
$connection = Yii::app()->db;
if (trim($labelParams['depts']) == '') {
    $sql = "select CODE,TITLE from fopen";
} else {
    $deptRow = Dept::model()->find('id=:id', array(':id' => $labelParams['depts']));
    $deptName = $deptRow['name'];
    /* Which all Files??*/
    if (isset($labelParams['fileNames'])) {
        $fileIDsText = implode(',', $labelParams['fileNames']);
        $sql = "select CODE,TITLE from fopen where ID IN ({$fileIDsText})";
    } else {
        if (!isset($labelParams['fileNames'])) {
            $sql = "select CODE,TITLE from fopen where DEPARTMENT='" . $deptName . "'";
        }
    }
}
$command = $connection->createCommand($sql);
$dataReader = $command->queryAll();
echo "<table>";
$numRows = ceil(count($dataReader) / $numColumns);
예제 #16
0
	    </tr>-->
	 
	    
	    <tr>
    	<div class="row">
	    	<div class="col-md-3 col-sm-6">
                    <?php 
//if(isset($model->dept_id)) $array = $model->dept_id;
//else $array = array();
?>
                    <div class="span2"><?php 
echo $form->labelEx($model, 'dept_id', array('class' => 'inline-labels'));
?>
</div>
                    <div class="span3"><?php 
echo Select2::activeMultiSelect($model, 'dept_id', CHtml::listData(Dept::model()->findAllByAttributes(array('orgid' => Yii::app()->user->getState("org_id"))), 'id', 'name'), array('select2Options' => array('width' => '65%', 'placeholder' => '--- Select Departments ---')));
?>
</div>
                    <div class="span2"><?php 
echo $form->labelEx($model, 'groups', array('class' => 'inline-labels'));
?>
</div>
	            <div class="span3"><?php 
echo Select2::activeMultiSelect($model, 'g_id', CHtml::listData(group::model()->findAll(), 'id', 'name'), array('select2Options' => array('width' => '65%', 'placeholder' => '--- Select Groups ---')));
?>
</div>
                    
                    
	        </div>
	</div>
	    </tr>
예제 #17
0
 function create($vars, &$errors, $origin, $autorespond = true, $alertstaff = true)
 {
     global $cfg, $thisclient, $_FILES;
     //Make sure the email is not banned
     if ($vars['email'] && EmailFilter::isBanned($vars['email'])) {
         $errors['err'] = 'Ticket denied. Error #403';
         Sys::log(LOG_WARNING, 'Ticket denied', 'Banned email - ' . $vars['email']);
         return 0;
     }
     $id = 0;
     $fields = array();
     $fields['name'] = array('type' => 'string', 'required' => 1, 'error' => 'Name required');
     $fields['email'] = array('type' => 'email', 'required' => 1, 'error' => 'Valid email required');
     $fields['subject'] = array('type' => 'string', 'required' => 1, 'error' => 'Subject required');
     $fields['message'] = array('type' => 'text', 'required' => 1, 'error' => 'Message required');
     switch (strtolower($origin)) {
         case 'web':
             $fields['topicId'] = array('type' => 'int', 'required' => 1, 'error' => 'Select help topic');
             break;
         case 'staff':
             $fields['deptId'] = array('type' => 'int', 'required' => 1, 'error' => 'Dept. required');
             $fields['topicId'] = array('type' => 'int', 'required' => 1, 'error' => 'Topic required');
             $fields['duedate'] = array('type' => 'date', 'required' => 0, 'error' => 'Invalid date - must be MM/DD/YY');
         case 'api':
             $fields['source'] = array('type' => 'string', 'required' => 1, 'error' => 'Indicate source');
             break;
         case 'email':
             $fields['emailId'] = array('type' => 'int', 'required' => 1, 'error' => 'Email unknown');
             break;
         default:
             # TODO: Return error message
             $errors['origin'] = 'Invalid origin given';
     }
     $fields['pri'] = array('type' => 'int', 'required' => 0, 'error' => 'Invalid Priority');
     $fields['phone'] = array('type' => 'phone', 'required' => 0, 'error' => 'Valid phone # required');
     if (!Validator::process($fields, $vars, $errors) && !$errors['err']) {
         $errors['err'] = 'Missing or invalid data - check the errors and try again';
     }
     //Make sure phone extension is valid
     if ($vars['phone_ext']) {
         if (!is_numeric($vars['phone_ext']) && !$errors['phone']) {
             $errors['phone'] = 'Invalid phone ext.';
         } elseif (!$vars['phone']) {
             //make sure they just didn't enter ext without phone # XXX: reconsider allowing!
             $errors['phone'] = 'Phone number required';
         }
     }
     //Make sure the due date is valid
     if ($vars['duedate']) {
         if (!$vars['time'] || strpos($vars['time'], ':') === false) {
             $errors['time'] = 'Select time';
         } elseif (strtotime($vars['duedate'] . ' ' . $vars['time']) === false) {
             $errors['duedate'] = 'Invalid duedate';
         } elseif (strtotime($vars['duedate'] . ' ' . $vars['time']) <= time()) {
             $errors['duedate'] = 'Due date must be in the future';
         }
     }
     //check attachment..if any is set ...only set on webbased tickets..
     //XXX:?? Create ticket anyway and simply drop the attachments?? We're already doing so with emails.
     if ($_FILES['attachment']['name'] && $cfg->allowOnlineAttachments()) {
         if (!$cfg->canUploadFileType($_FILES['attachment']['name'])) {
             $errors['attachment'] = 'Invalid file type [ ' . Format::htmlchars($_FILES['attachment']['name']) . ' ]';
         } elseif ($_FILES['attachment']['size'] > $cfg->getMaxFileSize()) {
             $errors['attachment'] = 'File is too big. Max ' . $cfg->getMaxFileSize() . ' bytes allowed';
         }
     }
     # Perform email filter actions on the new ticket arguments XXX: Move filter to the top and check for reject...
     if (!$errors && ($ef = new EmailFilter($vars))) {
         $ef->apply($vars);
     }
     # Some things will need to be unpacked back into the scope of this
     # function
     if (isset($vars['autorespond'])) {
         $autorespond = $vars['autorespond'];
     }
     //check ticket limits..if limit set is >0
     //TODO: Base ticket limits on SLA... XXX: move it elsewhere??
     if ($vars['email'] && !$errors && $cfg->getMaxOpenTickets() > 0 && strcasecmp($origin, 'staff')) {
         $openTickets = Ticket::getOpenTicketsByEmail($vars['email']);
         if ($openTickets >= $cfg->getMaxOpenTickets()) {
             $errors['err'] = "You've reached the maximum open tickets allowed.";
             //Send the notice only once (when the limit is reached) incase of autoresponders at client end.
             if ($cfg->getMaxOpenTickets() == $openTickets && $cfg->sendOverlimitNotice()) {
                 if ($vars['deptId']) {
                     $dept = Dept::lookup($vars['deptId']);
                 }
                 if (!$dept || !($tpl = $dept->getTemplate())) {
                     $tpl = $cfg->getDefaultTemplate();
                 }
                 if (!$dept || !($email = $dept->getAutoRespEmail())) {
                     $email = $cfg->getDefaultEmail();
                 }
                 if ($tpl && ($msg = $tpl->getOverlimitMsgTemplate()) && $email) {
                     $body = str_replace('%name', $vars['name'], $msg['body']);
                     $body = str_replace('%email', $vars['email'], $msg['body']);
                     $body = str_replace('%url', $cfg->getBaseUrl(), $body);
                     $body = str_replace('%signature', $dept && $dept->isPublic() ? $dept->getSignature() : '', $body);
                     $email->send($vars['email'], $msg['subj'], $body);
                 }
                 //Log + Alert admin...this might be spammy (no option to disable)...but it is helpful..I think.
                 $msg = 'Support ticket request denied for ' . $vars['email'] . "\n" . 'Open ticket:' . $openTickets . "\n" . 'Max Allowed:' . $cfg->getMaxOpenTickets() . "\n\nNotice only sent once";
                 Sys::log(LOG_CRIT, 'Overlimit Notice', $msg);
             }
         }
     }
     //Any error above is fatal.
     if ($errors) {
         return 0;
     }
     // OK...just do it.
     $deptId = $vars['deptId'];
     //pre-selected Dept if any.
     $priorityId = $vars['pri'];
     $source = ucfirst($vars['source']);
     $topic = NULL;
     // Intenal mapping magic...see if we need to overwrite anything
     if (isset($vars['topicId']) && ($topic = Topic::lookup($vars['topicId']))) {
         //Ticket created via web by user/or staff
         $deptId = $deptId ? $deptId : $topic->getDeptId();
         $priorityId = $priorityId ? $priorityId : $topic->getPriorityId();
         if ($autorespond) {
             $autorespond = $topic->autoRespond();
         }
         $source = $vars['source'] ? $vars['source'] : 'Web';
     } elseif ($vars['emailId'] && !$vars['deptId'] && ($email = Email::lookup($vars['emailId']))) {
         //Emailed Tickets
         $deptId = $email->getDeptId();
         $priorityId = $priorityId ? $priorityId : $email->getPriorityId();
         if ($autorespond) {
             $autorespond = $email->autoRespond();
         }
         $email = null;
         $source = 'Email';
     } elseif ($vars['deptId']) {
         //Opened by staff.
         $deptId = $vars['deptId'];
         $source = ucfirst($vars['source']);
     }
     //Last minute checks
     $priorityId = $priorityId ? $priorityId : $cfg->getDefaultPriorityId();
     $deptId = $deptId ? $deptId : $cfg->getDefaultDeptId();
     $topicId = $vars['topicId'] ? $vars['topicId'] : 0;
     $ipaddress = $vars['ip'] ? $vars['ip'] : $_SERVER['REMOTE_ADDR'];
     //We are ready son...hold on to the rails.
     $extId = Ticket::genExtRandID();
     $sql = 'INSERT INTO ' . TICKET_TABLE . ' SET created=NOW() ' . ' ,lastmessage= NOW()' . ' ,ticketID=' . db_input($extId) . ' ,dept_id=' . db_input($deptId) . ' ,topic_id=' . db_input($topicId) . ' ,priority_id=' . db_input($priorityId) . ' ,email=' . db_input($vars['email']) . ' ,name=' . db_input(Format::striptags($vars['name'])) . ' ,subject=' . db_input(Format::striptags($vars['subject'])) . ' ,phone="' . db_input($vars['phone'], false) . '"' . ' ,phone_ext=' . db_input($vars['phone_ext'] ? $vars['phone_ext'] : '') . ' ,ip_address=' . db_input($ipaddress) . ' ,source=' . db_input($source);
     //Make sure the origin is staff - avoid firebug hack!
     if ($vars['duedate'] && !strcasecmp($origin, 'staff')) {
         $sql .= ' ,duedate=' . db_input(date('Y-m-d G:i', Misc::dbtime($vars['duedate'] . ' ' . $vars['time'])));
     }
     if (!db_query($sql) || !($id = db_insert_id()) || !($ticket = Ticket::lookup($id))) {
         return null;
     }
     /* -------------------- POST CREATE ------------------------ */
     $dept = $ticket->getDept();
     if (!$cfg->useRandomIds()) {
         //Sequential ticketIDs support really..really suck arse.
         $extId = $id;
         //To make things really easy we are going to use autoincrement ticket_id.
         db_query('UPDATE ' . TICKET_TABLE . ' SET ticketID=' . db_input($extId) . ' WHERE ticket_id=' . $id . ' LIMIT 1');
         //TODO: RETHING what happens if this fails?? [At the moment on failure random ID is used...making stuff usable]
     }
     //post the message.
     $msgid = $ticket->postMessage($vars['message'], $source, $vars['mid'], $vars['header'], true);
     //TODO: recover from postMessage error??
     //Upload attachments...web based. - XXX: Assumes user uploaded attachments!! XXX: move it to client interface.
     if ($_FILES['attachment']['name'] && $cfg->allowOnlineAttachments() && $msgid) {
         if (!$cfg->allowAttachmentsOnlogin() || $cfg->allowAttachmentsOnlogin() && ($thisuser && $thisuser->isValid())) {
             $ticket->uploadAttachment($_FILES['attachment'], $msgid, 'M');
         }
     }
     // Configure service-level-agreement for this ticket
     $ticket->selectSLAId($vars['slaId']);
     //Auto assign staff or team - auto assignment based on filter rules.
     if ($vars['staffId'] && !$vars['assignId']) {
         $ticket->assignToStaff($vars['staffId'], 'auto-assignment');
     }
     if ($vars['teamId'] && !$vars['assignId']) {
         $ticket->assignToTeam($vars['teamId'], 'auto-assignment');
     }
     /**********   double check auto-response  ************/
     //Overwrite auto responder if the FROM email is one of the internal emails...loop control.
     if ($autorespond && Email::getIdByEmail($ticket->getEmail())) {
         $autorespond = false;
     }
     if ($autorespond && $dept && !$dept->autoRespONNewTicket()) {
         $autorespond = false;
     }
     # Messages that are clearly auto-responses from email systems should
     # not have a return 'ping' message
     if ($autorespond && $vars['header'] && EmailFilter::isAutoResponse(Mail_Parse::splitHeaders($vars['header']))) {
         $autorespond = false;
     }
     //Don't auto respond to mailer daemons.
     if ($autorespond && (strpos(strtolower($vars['email']), 'mailer-daemon@') !== false || strpos(strtolower($vars['email']), 'postmaster@') !== false)) {
         $autorespond = false;
     }
     /***** See if we need to send some alerts ****/
     $ticket->onNewTicket($vars['message'], $autorespond, $alertstaff);
     return $ticket;
 }
예제 #18
0
                <div class="span3"><?php 
echo $form->textField($model, 'name', array('span' => 2, 'maxlength' => 50, 'placeHolder' => 'Group Name'));
?>
</div>
	    </div>
	    </div>
	</tr>
        <tr>
    	<div class="row">
	    <div class="col-md-3 col-sm-6">
                <div class="span2"><?php 
echo $form->labelEx($model, 'dept_id', array('class' => 'inline-labels'));
?>
</div>
                <div class="span3"><?php 
echo $form->dropDownList($model, 'dept_id', CHtml::listData(Dept::model()->findAllByAttributes(array('orgid' => Yii::app()->user->getState("org_id"))), 'id', 'name'), array('span' => 2, 'prompt' => '---'));
?>
</div>
	    </div>
	    </div>
	</tr>
        <tr>
    	<div class="row">
	    <div class="col-md-3 col-sm-6">
                <div class="span2"><?php 
echo $form->labelEx($model, 'comments', array('class' => 'inline-labels'));
?>
</div>
                <div class="span3"><?php 
echo $form->textArea($model, 'comments', array('span' => 3, 'row' => 4));
?>
예제 #19
0
 function create($var, &$errors, $origin, $autorespond = true, $alertstaff = true)
 {
     global $cfg, $thisclient, $_FILES;
     /* Coders never code so fully and joyfully as when they do it for free  - Peter Rotich */
     $id = 0;
     $fields = array();
     $fields['name'] = array('type' => 'string', 'required' => 1, 'error' => 'Name required');
     $fields['email'] = array('type' => 'email', 'required' => 1, 'error' => 'Valid email required');
     $fields['subject'] = array('type' => 'string', 'required' => 1, 'error' => 'Subject required');
     $fields['message'] = array('type' => 'text', 'required' => 1, 'error' => 'Message required');
     if (strcasecmp($origin, 'web') == 0) {
         //Help topic only applicable on web tickets.
         $fields['topicId'] = array('type' => 'int', 'required' => 1, 'error' => 'Select help topic');
     } elseif (strcasecmp($origin, 'staff') == 0) {
         //tickets created by staff...e.g on callins.
         $fields['deptId'] = array('type' => 'int', 'required' => 1, 'error' => 'Dept. required');
         $fields['source'] = array('type' => 'string', 'required' => 1, 'error' => 'Indicate source');
         $fields['duedate'] = array('type' => 'date', 'required' => 0, 'error' => 'Invalid date - must be MM/DD/YY');
     } else {
         //Incoming emails
         $fields['emailId'] = array('type' => 'int', 'required' => 1, 'error' => 'Email unknown');
     }
     $fields['pri'] = array('type' => 'int', 'required' => 0, 'error' => 'Invalid Priority');
     $fields['phone'] = array('type' => 'phone', 'required' => 0, 'error' => 'Valid phone # required');
     $validate = new Validator($fields);
     if (!$validate->validate($var)) {
         $errors = array_merge($errors, $validate->errors());
     }
     //Make sure the email is not banned
     if (!$errors && BanList::isbanned($var['email'])) {
         $errors['err'] = 'Ticket denied. Error #403';
         //We don't want to tell the user the real reason...Psssst.
         Sys::log(LOG_WARNING, 'Ticket denied', 'Banned email - ' . $var['email']);
         //We need to let admin know which email got banned.
     }
     if (!$errors && $thisclient && strcasecmp($thisclient->getEmail(), $var['email'])) {
         $errors['email'] = 'Email mismatch.';
     }
     //Make sure phone extension is valid
     if ($var['phone_ext']) {
         if (!is_numeric($var['phone_ext']) && !$errors['phone']) {
             $errors['phone'] = 'Invalid phone ext.';
         } elseif (!$var['phone']) {
             //make sure they just didn't enter ext without phone #
             $errors['phone'] = 'Phone number required';
         }
     }
     //Make sure the due date is valid
     if ($var['duedate']) {
         if (!$var['time'] || strpos($var['time'], ':') === false) {
             $errors['time'] = 'Select time';
         } elseif (strtotime($var['duedate'] . ' ' . $var['time']) === false) {
             $errors['duedate'] = 'Invalid duedate';
         } elseif (strtotime($var['duedate'] . ' ' . $var['time']) <= time()) {
             $errors['duedate'] = 'Due date must be in the future';
         }
     }
     //check attachment..if any is set ...only set on webbased tickets..
     if ($_FILES['attachment']['name'] && $cfg->allowOnlineAttachments()) {
         if (!$cfg->canUploadFileType($_FILES['attachment']['name'])) {
             $errors['attachment'] = 'Invalid file type [ ' . Format::htmlchars($_FILES['attachment']['name']) . ' ]';
         } elseif ($_FILES['attachment']['size'] > $cfg->getMaxFileSize()) {
             $errors['attachment'] = 'File is too big. Max ' . $cfg->getMaxFileSize() . ' bytes allowed';
         }
     }
     //check ticket limits..if limit set is >0
     //TODO: Base ticket limits on SLA...
     if ($var['email'] && !$errors && $cfg->getMaxOpenTickets() > 0 && strcasecmp($origin, 'staff')) {
         $openTickets = Ticket::getOpenTicketsByEmail($var['email']);
         if ($openTickets >= $cfg->getMaxOpenTickets()) {
             $errors['err'] = "You've reached the maximum open tickets allowed.";
             //Send the notice only once (when the limit is reached) incase of autoresponders at client end.
             if ($cfg->getMaxOpenTickets() == $openTickets && $cfg->sendOverlimitNotice()) {
                 if ($var['deptId']) {
                     $dept = new Dept($var['deptId']);
                 }
                 if (!$dept || !($tplId = $dept->getTemplateId())) {
                     $tplId = $cfg->getDefaultTemplateId();
                 }
                 $sql = 'SELECT ticket_overlimit_subj,ticket_overlimit_body FROM ' . EMAIL_TEMPLATE_TABLE . ' WHERE cfg_id=' . db_input($cfg->getId()) . ' AND tpl_id=' . db_input($tplId);
                 $resp = db_query($sql);
                 if (db_num_rows($resp) && (list($subj, $body) = db_fetch_row($resp))) {
                     $body = str_replace("%name", $var['name'], $body);
                     $body = str_replace("%email", $var['email'], $body);
                     $body = str_replace("%url", $cfg->getBaseUrl(), $body);
                     $body = str_replace('%signature', $dept && $dept->isPublic() ? $dept->getSignature() : '', $body);
                     if (!$dept || !($email = $dept->getAutoRespEmail())) {
                         $email = $cfg->getDefaultEmail();
                     }
                     if ($email) {
                         $email->send($var['email'], $subj, $body);
                     }
                 }
                 //Alert admin...this might be spammy (no option to disable)...but it is helpful..I think.
                 $msg = 'Support ticket request denied for ' . $var['email'] . "\n" . 'Open ticket:' . $openTickets . "\n" . 'Max Allowed:' . $cfg->getMaxOpenTickets() . "\n\nNotice only sent once";
                 Sys::alertAdmin('Overlimit Notice', $msg);
             }
         }
     }
     //Any error above is fatal.
     if ($errors) {
         return 0;
     }
     // OK...just do it.
     $deptId = $var['deptId'];
     //pre-selected Dept if any.
     $priorityId = $var['pri'];
     $source = ucfirst($var['source']);
     $topic = NULL;
     // Intenal mapping magic...see if we need to overwrite anything
     if (isset($var['topicId'])) {
         //Ticket created via web by user/or staff
         if ($var['topicId'] && ($topic = new Topic($var['topicId'])) && $topic->getId()) {
             $deptId = $deptId ? $deptId : $topic->getDeptId();
             $priorityId = $priorityId ? $priorityId : $topic->getPriorityId();
             $topicDesc = $topic->getName();
             if ($autorespond) {
                 $autorespond = $topic->autoRespond();
             }
         }
         $source = $var['source'] ? $var['source'] : 'Web';
     } elseif ($var['emailId'] && !$var['deptId']) {
         //Emailed Tickets
         $email = new Email($var['emailId']);
         if ($email && $email->getId()) {
             $deptId = $email->getDeptId();
             $priorityId = $priorityId ? $priorityId : $email->getPriorityId();
             if ($autorespond) {
                 $autorespond = $email->autoRespond();
             }
         }
         $email = null;
         $source = 'Email';
     } elseif ($var['deptId']) {
         //Opened by staff.
         $deptId = $var['deptId'];
         $source = ucfirst($var['source']);
     }
     //Don't auto respond to mailer daemons.
     if (strpos(strtolower($var['email']), 'mailer-daemon@') !== false || strpos(strtolower($var['email']), 'postmaster@') !== false) {
         $autorespond = false;
     }
     //Last minute checks
     $priorityId = $priorityId ? $priorityId : $cfg->getDefaultPriorityId();
     $deptId = $deptId ? $deptId : $cfg->getDefaultDeptId();
     $topicId = $var['topicId'] ? $var['topicId'] : 0;
     $ipaddress = $var['ip'] ? $var['ip'] : $_SERVER['REMOTE_ADDR'];
     //We are ready son...hold on to the rails.
     $extId = Ticket::genExtRandID();
     $sql = 'INSERT INTO ' . TICKET_TABLE . ' SET created=NOW() ' . ',ticketID=' . db_input($extId) . ',dept_id=' . db_input($deptId) . ',topic_id=' . db_input($topicId) . ',priority_id=' . db_input($priorityId) . ',email=' . db_input($var['email']) . ',name=' . db_input(Format::striptags($var['name'])) . ',subject=' . db_input(Format::striptags($var['subject'])) . ',helptopic=' . db_input(Format::striptags($topicDesc)) . ',phone="' . db_input($var['phone'], false) . '"' . ',phone_ext=' . db_input($var['phone_ext'] ? $var['phone_ext'] : '') . ',ip_address=' . db_input($ipaddress) . ',source=' . db_input($source);
     //Make sure the origin is staff - avoid firebug hack!
     if ($var['duedate'] && !strcasecmp($origin, 'staff')) {
         $sql .= ',duedate=' . db_input(date('Y-m-d G:i', Misc::dbtime($var['duedate'] . ' ' . $var['time'])));
     }
     //echo $sql;
     $ticket = null;
     //return $ticket;
     if (db_query($sql) && ($id = db_insert_id())) {
         if (!$cfg->useRandomIds()) {
             //Sequential ticketIDs support really..really suck arse.
             $extId = $id;
             //To make things really easy we are going to use autoincrement ticket_id.
             db_query('UPDATE ' . TICKET_TABLE . ' SET ticketID=' . db_input($extId) . ' WHERE ticket_id=' . $id);
             //TODO: RETHING what happens if this fails?? [At the moment on failure random ID is used...making stuff usable]
         }
         //Load newly created ticket.
         $ticket = new Ticket($id);
         //post the message.
         $msgid = $ticket->postMessage($var['message'], $source, $var['mid'], $var['header'], true);
         //TODO: recover from postMessage error??
         //Upload attachments...web based.
         if ($_FILES['attachment']['name'] && $cfg->allowOnlineAttachments() && $msgid) {
             if (!$cfg->allowAttachmentsOnlogin() || $cfg->allowAttachmentsOnlogin() && ($thisclient && $thisclient->isValid())) {
                 $ticket->uploadAttachment($_FILES['attachment'], $msgid, 'M');
                 //TODO: recover from upload issues?
             }
         }
         $dept = $ticket->getDept();
         if (!$dept || !($tplId = $dept->getTemplateId())) {
             $tplId = $cfg->getDefaultTemplateId();
         }
         //Overwrite auto responder if the FROM email is one of the internal emails...loop control.
         if ($autorespond && Email::getIdByEmail($ticket->getEmail())) {
             $autorespond = false;
         }
         //SEND OUT NEW TICKET AUTORESP && ALERTS.
         //New Ticket AutoResponse..
         if ($autorespond && $cfg->autoRespONNewTicket() && $dept->autoRespONNewTicket()) {
             $sql = 'SELECT ticket_autoresp_subj,ticket_autoresp_body FROM ' . EMAIL_TEMPLATE_TABLE . ' WHERE cfg_id=' . db_input($cfg->getId()) . ' AND tpl_id=' . db_input($tplId);
             if (($resp = db_query($sql)) && db_num_rows($resp) && (list($subj, $body) = db_fetch_row($resp))) {
                 $body = $ticket->replaceTemplateVars($body);
                 $subj = $ticket->replaceTemplateVars($subj);
                 $body = str_replace('%message', $var['issue'] ? $var['issue'] : $var['message'], $body);
                 $body = str_replace('%signature', $dept && $dept->isPublic() ? $dept->getSignature() : '', $body);
                 if (!$dept || !($email = $dept->getAutoRespEmail())) {
                     $email = $cfg->getDefaultEmail();
                 }
                 if ($email) {
                     //Reply separator tag.
                     if ($cfg->stripQuotedReply() && ($tag = $cfg->getReplySeparator())) {
                         $body = "\n{$tag}\n\n" . $body;
                     }
                     $email->send($ticket->getEmail(), $subj, $body);
                 }
             } else {
                 Sys::log(LOG_WARNING, 'Template Fetch Error', "Unable to fetch autoresponse template #{$tplId}");
             }
         }
         //If enabled...send alert to staff (New Ticket Alert)
         if ($alertstaff && $cfg->alertONNewTicket() && is_object($ticket)) {
             $sql = 'SELECT ticket_alert_subj,ticket_alert_body FROM ' . EMAIL_TEMPLATE_TABLE . ' WHERE cfg_id=' . db_input($cfg->getId()) . ' AND tpl_id=' . db_input($tplId);
             if (($resp = db_query($sql)) && db_num_rows($resp) && (list($subj, $body) = db_fetch_row($resp))) {
                 $body = $ticket->replaceTemplateVars($body);
                 $subj = $ticket->replaceTemplateVars($subj);
                 $body = str_replace('%message', $var['issue'] ? $var['issue'] : $var['message'], $body);
                 if (!($email = $cfg->getAlertEmail())) {
                     $email = $cfg->getDefaultEmail();
                 }
                 if ($email && $email->getId()) {
                     $sentlist = array();
                     //Admin Alert.
                     if ($cfg->alertAdminONNewTicket()) {
                         $alert = str_replace("%staff", 'Admin', $body);
                         $email->send($cfg->getAdminEmail(), $subj, $alert);
                         $sentlist[] = $cfg->getAdminEmail();
                     }
                     //get the list
                     $recipients = array();
                     //Dept. Manager
                     if ($cfg->alertDeptManagerONNewTicket()) {
                         $recipients[] = $dept->getManager();
                     }
                     //Staff members
                     if ($cfg->alertDeptMembersONNewTicket()) {
                         $sql = 'SELECT staff_id FROM ' . STAFF_TABLE . ' WHERE onvacation=0 AND dept_id=' . db_input($dept->getId());
                         if (($users = db_query($sql)) && db_num_rows($users)) {
                             while (list($id) = db_fetch_row($users)) {
                                 $recipients[] = new Staff($id);
                             }
                         }
                     }
                     foreach ($recipients as $k => $staff) {
                         if (!$staff || !is_object($staff) || !$staff->isAvailable()) {
                             continue;
                         }
                         if (in_array($staff->getEmail(), $sentlist)) {
                             continue;
                         }
                         //avoid duplicate emails.
                         $alert = str_replace("%staff", $staff->getFirstName(), $body);
                         $email->send($staff->getEmail(), $subj, $alert);
                         $sentlist[] = $staff->getEmail();
                     }
                 }
             } else {
                 Sys::log(LOG_WARNING, 'Template Fetch Error', "Unable to fetch 'new ticket' alert template #{$tplId}");
             }
         }
     }
     return $ticket;
 }
?>
" title="Sort By Department"><?php 
echo __('Department');
?>
</a>
            </th>
        </tr>
    </thead>
    <tbody>
    <?php 
$subject_field = TicketForm::objects()->one()->getField('subject');
$defaultDept = Dept::getDefaultDeptName();
//Default public dept.
if ($tickets->exists(true)) {
    foreach ($tickets as $T) {
        $dept = $T['dept__ispublic'] ? Dept::getLocalById($T['dept_id'], 'name', $T['dept__name']) : $defaultDept;
        $subject = $subject_field->display($subject_field->to_php($T['cdata__subject']) ?: $T['cdata__subject']);
        $status = TicketStatus::getLocalById($T['status_id'], 'value', $T['status__name']);
        if (false) {
            // XXX: Reimplement attachment count support
            $subject .= '  &nbsp;&nbsp;<span class="Icon file"></span>';
        }
        $ticketNumber = $T['number'];
        if ($T['isanswered'] && !strcasecmp($T['status__state'], 'open')) {
            $subject = "<b>{$subject}</b>";
            $ticketNumber = "<b>{$ticketNumber}</b>";
        }
        ?>
            <tr id="<?php 
        echo $T['ticket_id'];
        ?>
예제 #21
0
 function save($id, $vars, &$errors)
 {
     global $cfg;
     if ($id && $id != $vars['id']) {
         $errors['err'] = __('Missing or invalid Dept ID (internal error).');
     }
     if (!$vars['name']) {
         $errors['name'] = __('Name required');
     } elseif (strlen($vars['name']) < 4) {
         $errors['name'] = __('Name is too short.');
     } elseif (($did = Dept::getIdByName($vars['name'])) && $did != $id) {
         $errors['name'] = __('Department already exists');
     }
     if (!$vars['ispublic'] && $cfg && $vars['id'] == $cfg->getDefaultDeptId()) {
         $errors['ispublic'] = __('System default department cannot be private');
     }
     if ($errors) {
         return false;
     }
     $sql = 'SET updated=NOW() ' . ' ,ispublic=' . db_input(isset($vars['ispublic']) ? $vars['ispublic'] : 0) . ' ,email_id=' . db_input(isset($vars['email_id']) ? $vars['email_id'] : 0) . ' ,tpl_id=' . db_input(isset($vars['tpl_id']) ? $vars['tpl_id'] : 0) . ' ,sla_id=' . db_input(isset($vars['sla_id']) ? $vars['sla_id'] : 0) . ' ,autoresp_email_id=' . db_input(isset($vars['autoresp_email_id']) ? $vars['autoresp_email_id'] : 0) . ' ,manager_id=' . db_input($vars['manager_id'] ? $vars['manager_id'] : 0) . ' ,dept_name=' . db_input(Format::striptags($vars['name'])) . ' ,dept_signature=' . db_input(Format::sanitize($vars['signature'])) . ' ,group_membership=' . db_input($vars['group_membership']) . ' ,ticket_auto_response=' . db_input(isset($vars['ticket_auto_response']) ? $vars['ticket_auto_response'] : 1) . ' ,message_auto_response=' . db_input(isset($vars['message_auto_response']) ? $vars['message_auto_response'] : 1);
     if ($id) {
         $sql = 'UPDATE ' . DEPT_TABLE . ' ' . $sql . ' WHERE dept_id=' . db_input($id);
         if (db_query($sql) && db_affected_rows()) {
             return true;
         }
         $errors['err'] = sprintf(__('Unable to update %s.'), __('this department')) . ' ' . __('Internal error occurred');
     } else {
         if (isset($vars['id'])) {
             $sql .= ', dept_id=' . db_input($vars['id']);
         }
         $sql = 'INSERT INTO ' . DEPT_TABLE . ' ' . $sql . ',created=NOW()';
         if (db_query($sql) && ($id = db_insert_id())) {
             return $id;
         }
         $errors['err'] = sprintf(__('Unable to create %s.'), __('this department')) . ' ' . __('Internal error occurred');
     }
     return false;
 }
예제 #22
0
?>
		<div class="well">

			    <form action="controller.php?action=delete" Method="POST">  					
				<table class="table table-hover">
					<caption><h3 align="left">List of Department</h3></caption>
				  <thead>
				  	<tr>
				  		<th> <input type="checkbox" name="chkall" id="chkall" onclick="return checkall('selector[]');"> Department Name</th>
				  		<th>Department Description</th>
				 
				  	</tr>	
				  </thead>
				  <tbody>
				  	<?php 
$dept = new Dept();
$cur = $dept->listOfDept();
foreach ($cur as $Department) {
    echo '<tr>';
    echo '<td><input type="checkbox" name="selector[]" id="selector[]" value="' . $Department->DEPT_ID . '"/>
				  				<a href="index.php?view=edit&id=' . $Department->DEPT_ID . '">' . $Department->DEPARTMENT_NAME . '</a></td>';
    echo '<td colspan="3">' . $Department->DEPARTMENT_DESC . '</td>';
    echo '</tr>';
}
?>
				  </tbody>
				  <tfoot>
				  	<tr><td></td><td></td></tr>
				  </tfoot>	
				</table>
				<?php 
예제 #23
0
    echo __('Department');
    ?>
:</strong></label>
                </td>
                <td>
                    <?php 
    echo sprintf('<span class="faded">' . __('Ticket is currently in <b>%s</b> department.') . '</span>', $ticket->getDeptName());
    ?>
                    <br>
                    <select id="deptId" name="deptId">
                        <option value="0" selected="selected">&mdash; <?php 
    echo __('Select Target Department');
    ?>
 &mdash;</option>
                        <?php 
    if ($depts = Dept::getDepartments()) {
        foreach ($depts as $id => $name) {
            if ($id == $ticket->getDeptId()) {
                continue;
            }
            echo sprintf('<option value="%d" %s>%s</option>', $id, $info['deptId'] == $id ? 'selected="selected"' : '', $name);
        }
    }
    ?>
                    </select>&nbsp;<span class='error'>*&nbsp;<?php 
    echo $errors['deptId'];
    ?>
</span>
                </td>
            </tr>
            <tr>
예제 #24
0
 function setDeptId($deptId)
 {
     //Make sure it's a valid department//
     if (!($dept = Dept::lookup($deptId)) || $dept->getId() == $this->getDeptId()) {
         return false;
     }
     $sql = 'UPDATE ' . TICKET_TABLE . ' SET updated=NOW(), dept_id=' . db_input($deptId) . ' WHERE ticket_id=' . db_input($this->getId());
     return db_query($sql) && db_affected_rows();
 }
예제 #25
0
     $fields = array();
     $fields['dept_id'] = array('type' => 'int', 'required' => 1, 'error' => 'Select Department');
     $fields['message'] = array('type' => 'text', 'required' => 1, 'error' => 'Note/Message required');
     $params = new Validator($fields);
     if (!$params->validate($_POST)) {
         $errors = array_merge($errors, $params->errors());
     }
     if (!$errors && $_POST['dept_id'] == $ticket->getDeptId()) {
         $errors['dept_id'] = 'Ticket already in the Dept.';
     }
     if (!$errors && !$thisuser->canTransferTickets()) {
         $errors['err'] = 'Action Denied. You are not allowed to transfer tickets.';
     }
     if (!$errors && $ticket->transfer($_POST['dept_id'])) {
         //Send out alerts??
         $title = 'Dept. Transfer: ' . $ticket->getDeptName() . ' to ' . Dept::getNameById($_POST['dept_id']);
         $ticket->postNote($title, $_POST['message']);
         $msg = 'Ticket Transfered Sucessfully';
     } else {
         $errors['err'] = $errors['err'] ? $errors['err'] : 'Unable to complete the transfer';
     }
     break;
 case 'assign':
     $fields = array();
     $fields['staffId'] = array('type' => 'int', 'required' => 1, 'error' => 'Select assignee');
     $fields['assign_message'] = array('type' => 'text', 'required' => 1, 'error' => 'Message required');
     $params = new Validator($fields);
     if (!$params->validate($_POST)) {
         $errors = array_merge($errors, $params->errors());
     }
     if (!$errors && $ticket->isAssigned()) {
예제 #26
0
파일: _form.php 프로젝트: wanyos2005/hsbf
                                        <div class="col-md-8">
                                                <?php 
echo CHtml::activeTextArea($model, 'address', array('class' => 'form-control', 'rows' => 3));
?>
                                                <?php 
echo CHtml::error($model, 'address');
?>
                                        </div>
                                </div>
                                <div class="form-group">
                                        <?php 
echo CHtml::activeLabelEx($model, 'status', array('class' => 'col-md-3 control-label'));
?>
                                        <div class="col-md-8">
                                                <?php 
echo CHtml::activeDropDownList($model, 'status', Dept::statusOptions(), array('class' => 'form-control'));
?>
                                        </div>
                                </div>
                        </div>
                </div>
        </div>
        <div class="col-md-6">
                <div class="panel panel-default">
                        <div class="panel-heading">
                                <h4 class="panel-title"><?php 
echo Lang::t('Geo Location');
?>
</h4>
                        </div>
                        <div class="panel-body">
예제 #27
0
 static function create($vars, &$errors)
 {
     return Dept::save(0, $vars, $errors);
 }
예제 #28
0
          <option value="">&mdash; <?php echo __('Any Status');?> &mdash;</option>
         <?php
         foreach (TicketStatusList::getStatuses(
                     array('states' => array('open', 'closed'))) as $s) {
             echo sprintf('<option data-state="%s" value="%d">%s</option>',
                     $s->getState(), $s->getId(), __($s->getName()));
         }
         ?>
     </select>
 </fieldset>
 <fieldset class="span6">
     <label for="deptId"><?php echo __('Departments');?>:</label>
     <select id="deptId" name="deptId">
         <option value="">&mdash; <?php echo __('All Departments');?> &mdash;</option>
         <?php
         if(($mydepts = $thisstaff->getDepts()) && ($depts=Dept::getDepartments())) {
             foreach($depts as $id =>$name) {
                 if(!in_array($id, $mydepts)) continue;
                 echo sprintf('<option value="%d">%s</option>', $id, $name);
             }
         }
         ?>
     </select>
 </fieldset>
 <fieldset class="span6">
     <label for="flag"><?php echo __('Flags');?>:</label>
     <select id="flag" name="flag">
          <option value="">&mdash; <?php echo __('Any Flags');?> &mdash;</option>
          <?php
          if (!$cfg->showAnsweredTickets()) { ?>
          <option data-state="open" value="answered"><?php echo __('Answered');?></option>
예제 #29
0
    <p class="help-block">Fields with <span class="required">*</span> are required.</p>

    <?php 
echo $form->errorSummary($model);
?>
        <?php 
if (isset($_GET['owner'])) {
    $owner = $_GET['owner'];
    $ownerRow = User::model()->findByAttributes(array('name' => $owner));
    $ownerId = $ownerRow['id'];
} else {
    $ownerId = '';
}
if (isset($_GET['deptName'])) {
    $deptName = $_GET['deptName'];
    $deptRow = Dept::model()->findByAttributes(array('name' => $deptName));
    $deptId = $deptRow['id'];
} else {
    $deptId = '';
}
$validUsersIdRows = Userdept::model()->findAll('dept_id =:dept_id AND uid !=:uid', array('dept_id' => $deptId, 'uid' => $ownerId));
$transferTo = [];
foreach ($validUsersIdRows as $user) {
    $u = User::model()->findByPk($user['uid']);
    $transferTo[$u['id']] = $u['name'];
}
?>
   
    
    
	<table>
예제 #30
0
echo $form->dropDownList($model, 'fileType', CHtml::listData(FileType::model()->findAll(), 'id', 'name'), array('prompt' => '---', 'ajax' => array('type' => 'POST', 'id' => 'drop_selection', 'url' => CController::createUrl('dynamicrows2'), 'update' => '#details', 'data' => array('selection' => 'js:this.value'))));
?>
</div>  
                    <div class="span2" id="details"><span class="label label-info"> Default : Label Size:100px X 50px</span></div>
                </div>
            </div>
        </tr>
        <tr>
            <div class="row">
                <div class="col-md-3 col-sm-6">
                    <div class="span2"><?php 
echo $form->labelEx($model, 'depts', array('class' => 'inline-labels'));
?>
</div>
                    <div class="span3"><?php 
echo $form->dropDownList($model, 'depts', CHtml::listData(Dept::model()->findAllByAttributes(array('orgid' => Yii::app()->user->getState("org_id"))), 'id', 'name'), array('prompt' => '--- Select Department ---', 'ajax' => array('type' => 'POST', 'id' => 'drop_selection', 'url' => CController::createUrl('dynamicrows'), 'update' => '#Label_fileNames', 'data' => array('selection' => 'js:this.value'))));
?>
 </div>
                    <div class="span2"><span class="label label-info"> Default : All Departments Selected</span></div>
                </div>
            </div>
        </tr>
        <br/>
        <tr>
            <div class="row">
                <div class="col-md-3 col-sm-6">
                    <div class="span2"><?php 
echo $form->labelEx($model, 'fileNames', array('class' => 'inline-labels'));
?>
</div>
                    <div class="span3"><?php