本文整理汇总了PHP中Dept类的典型用法代码示例。如果您正苦于以下问题:PHP Dept类的具体用法?PHP Dept怎么用?PHP Dept使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Dept类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: doDelete
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: authenticate
/**
* 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: actionIndex
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: getDept
function getDept()
{
if (!$this->dept && $this->getDeptId()) {
$this->dept = Dept::lookup($this->getDeptId());
}
return $this->dept;
}
示例5: actionDelete
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'));
}
}
示例6: actionDynamicRows
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;
}
示例7: actionGetDeptInfo
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: setDept
/**
* 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: actionCreate
/**
* 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: getDept
/**
*@author: wawan
*@return relational database Departement
*/
public function getDept()
{
return $this->hasOne(Dept::className(), ['DEP_ID' => 'KD_DEP']);
}
示例11: elseif
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: while
?>
</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 .= ' <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: foreach
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: or
$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: floor
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);