本文整理汇总了PHP中Prefs类的典型用法代码示例。如果您正苦于以下问题:PHP Prefs类的具体用法?PHP Prefs怎么用?PHP Prefs使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Prefs类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: validateCredentials
/**
* Used to vaidate a user's credentials. (uname, pass)
* @param array $creds the uname and password passed in as an array.
* @return bool
*/
function validateCredentials($creds)
{
$pwent = posix_getpwnam(strtolower($creds['uname']));
if ($pwent == false) {
API::Error("Invalid Username/Password");
}
$cryptpw = crypt($creds['password'], $pwent['passwd']);
if ($cryptpw == $pwent['passwd']) {
API::DEBUG("[Auth_NIS::validateCredentials] returning TRUE", 8);
$_SESSION['authed_user'] = $pwent['uid'];
$this->authed_user = $pwent['uid'];
$names = explode(" ", $pwent['gecos'], 2);
$names['fname'] = $names[0];
$names['lname'] = $names[1];
unset($names[1]);
unset($names[0]);
$prefs = new Prefs();
if ($prefs->checkUID($this->authed_user, $this->config->prefs_auto, NULL, $names)) {
return TRUE;
} else {
API::Error("Username Not Valid in system. Error: 3304");
}
}
return FALSE;
}
示例2: getIndex
public function getIndex()
{
$categories = Prefs::getCategory()->catToSelection('title', 'title');
$this->heads = array(array('Title', array('search' => true, 'sort' => true)), array('Creator', array('search' => true, 'sort' => false)), array('Category', array('search' => true, 'select' => $categories, 'sort' => true)), array('Tags', array('search' => true, 'sort' => true)), array('Created', array('search' => true, 'sort' => true, 'date' => true)), array('Last Update', array('search' => true, 'sort' => true, 'date' => true)));
//print $this->model->where('docFormat','picture')->get()->toJSON();
return parent::getIndex();
}
示例3: getInstance
public static function getInstance()
{
if (self::$instance == null) {
self::$instance = new Prefs();
}
return self::$instance;
}
示例4: _createContent
/**
* Commentaires d'une procedure
*
* @author Christophe Beyer <cbeyer@cap-tic.fr>
* @since 2008/01/30
* @param object $rFiche Recordset de la procedure
*/
public function _createContent(&$toReturn)
{
$tpl = new CopixTpl();
$rFiche = $this->getParam('rFiche');
$mondroit = $this->getParam('mondroit');
$daoinfo =& _dao('infosupp');
$sql = 'SELECT * FROM module_teleprocedure_infosupp WHERE idinter=' . $rFiche->idinter . '';
$canCheckVisible = TeleproceduresService::canMakeInTelep('CHECK_VISIBLE', $mondroit);
$canAddComment = TeleproceduresService::canMakeInTelep('ADD_COMMENT', $mondroit);
if (!$canCheckVisible) {
$sql .= " AND info_message!='' AND info_message IS NOT NULL";
}
$sql .= " ORDER BY dateinfo ASC, idinfo ASC";
$results = _doQuery($sql);
// Pour chaque message on cherche les infos de son auteur
$list = array();
foreach ($results as $r) {
$userInfo = Kernel::getUserInfo("ID", $r->iduser);
//var_dump($userInfo);
$avatar = Prefs::get('prefs', 'avatar', $r->iduser);
$userInfo['avatar'] = $avatar ? CopixConfig::get('prefs|avatar_path') . $avatar : '';
$r->user = $userInfo;
$list[] = $r;
}
//print_r($rFiche);
$tpl->assign('info_message_edition', CopixZone::process('kernel|edition', array('field' => 'info_message', 'format' => $rFiche->type_format, 'content' => '', 'width' => 350, 'height' => 135, 'options' => array('toolbarSet' => 'IconitoBasic', 'enterMode' => 'br', 'toolbarStartupExpanded' => 'false'))));
$tpl->assign('info_commentaire_edition', CopixZone::process('kernel|edition', array('field' => 'info_commentaire', 'format' => $rFiche->type_format, 'content' => '', 'width' => 350, 'height' => 135, 'options' => array('toolbarSet' => 'IconitoBasic', 'enterMode' => 'br', 'toolbarStartupExpanded' => 'false'))));
$tpl->assign('canCheckVisible', $canCheckVisible);
$tpl->assign('canAddComment', $canAddComment);
$tpl->assign('list', $list);
$tpl->assign('rFiche', $rFiche);
$toReturn = $tpl->fetch('fiche-comms-zone.tpl');
return true;
}
示例5: actionVersion
public function actionVersion()
{
if (isset($_POST['version'])) {
Yii::app()->end(Prefs::getVersion());
}
Yii::app()->end('1');
}
示例6: getIndex
public function getIndex()
{
$this->heads = array(array('Role', array('search' => true, 'sort' => false, 'select' => Prefs::getRole()->RoleToSelection('_id', 'rolename'))), array('Created', array('search' => true, 'sort' => true, 'date' => true)), array('Last Update', array('search' => true, 'sort' => true, 'date' => true)));
//print $this->model->where('docFormat','picture')->get()->toJSON();
Breadcrumbs::addCrumb('System', URL::to(strtolower($this->controller_name)));
return parent::getIndex();
}
示例7: getIndex
public function getIndex()
{
$this->heads = array(array('Full Name', array('search' => true, 'sort' => true)), array('Role', array('search' => true, 'sort' => false, 'select' => Prefs::getRole()->RoleToSelection('_id', 'rolename'))), array('Email', array('search' => true, 'sort' => true)), array('Mobile', array('search' => true, 'sort' => true)), array('Address', array('search' => true, 'sort' => true)), array('Created', array('search' => true, 'sort' => true, 'date' => true)), array('Last Update', array('search' => true, 'sort' => true, 'date' => true)));
$this->title = 'Employees';
$this->place_action = 'first';
Breadcrumbs::addCrumb('HRMS', URL::to(strtolower($this->controller_name)));
return parent::getIndex();
}
示例8: getIndex
public function getIndex()
{
$categories = Prefs::getCategory()->catToSelection('title', 'title');
$this->heads = array(array('Title', array('search' => true, 'sort' => true)), array('Status', array('search' => true, 'sort' => true)), array('Creator', array('search' => true, 'sort' => false)), array('Category', array('search' => true, 'select' => $categories, 'sort' => true)), array('Tags', array('search' => true, 'sort' => true)), array('Created', array('search' => true, 'sort' => true, 'date' => true)), array('Last Update', array('search' => true, 'sort' => true, 'date' => true)));
//print $this->model->where('docFormat','picture')->get()->toJSON();
$this->modal_sets = View::make(strtolower($this->controller_name) . '.modal')->render();
$this->js_table_event = View::make(strtolower($this->controller_name) . '.jsevent')->render();
return parent::getIndex();
}
示例9: getIndex
public function getIndex()
{
$this->heads = array(array('Full Name', array('search' => true, 'sort' => true)), array('Role', array('search' => true, 'sort' => false, 'select' => Prefs::getRole()->RoleToSelection('_id', 'rolename'))), array('Email', array('search' => true, 'sort' => true)), array('Mobile', array('search' => true, 'sort' => true)), array('Address', array('search' => true, 'sort' => true)), array('Created', array('search' => true, 'sort' => true, 'date' => true)), array('Last Update', array('search' => true, 'sort' => true, 'date' => true)));
$this->title = 'Users';
$this->place_action = 'first';
Breadcrumbs::addCrumb('Profile', URL::to(strtolower($this->controller_name)));
//return parent::getIndex();
$bt_edit = '<a href="' . URL::to('profile/edit/' . Auth::user()->_id) . '" class="btn btn-sm btn-primary btn-transparent"><i class="fa fa-edit"></i> Edit</a>';
return View::make('profile.index')->with('title', Auth::user()->fullname . ' ' . $bt_edit);
}
示例10: sendMinimail
/**
* Envoie un minimail
*
* @author Christophe Beyer <cbeyer@cap-tic.fr>
* @since 2005/10/18
* @param string title Titre du minimail
* @param string message Corps du minimail
* @param integer from_id Id utilisateur de l'exp�diteur
* @param array destin Id tableau avec les destinataires (cl� = id user)
* @return mixed Id du message cr�� ou NULL si erreur
*/
public function sendMinimail($title, $message, $from_id, $destin, $format)
{
$res = NULL;
$DAOminimail_from = _dao("minimail|minimail_from");
$DAOminimail_to = _dao("minimail|minimail_to");
$newMp = _record("minimail|minimail_from");
$newMp->title = $title;
$newMp->message = $message;
$newMp->format = $format;
$newMp->date_send = date("Y-m-d H:i:s");
$newMp->from_id = $from_id;
$newMp->is_deleted = 0;
$DAOminimail_from->insert($newMp);
if ($newMp->id !== NULL) {
//print_r($newMp);
// On parcourt chaque destinataire
while (list($to_id, ) = each($destin)) {
// print_r("to_id=$to_id / to_login=$to_login");
$newDest = _record("minimail|minimail_to");
$newDest->id_message = $newMp->id;
$newDest->to_id = $to_id;
$newDest->date_read = 0;
$newDest->is_read = 0;
$newDest->is_replied = 0;
$newDest->is_deleted = 0;
$DAOminimail_to->insert($newDest);
// ======= Alerte mail ===============
// On vérifie que l'envoi de mails est activé, qu'un serveur SMTP est configuré, que le destinataire a coché l'option "etre prêvenu par mail" et qu'il a renseigné un mail
if ($newDest->id2 && CopixConfig::get('|mailEnabled') == 1 && CopixConfig::get('|mailSmtpHost')) {
$prefs = Prefs::getPrefs($to_id);
if (isset($prefs['prefs']['alerte_mail_email']) && isset($prefs['minimail']['alerte_minimail']) && $prefs['prefs']['alerte_mail_email'] && $prefs['minimail']['alerte_minimail'] == 1) {
$userInfoFrom = Kernel::getUserInfo("ID", $from_id);
//print_r($userInfoFrom);
$to = $prefs['prefs']['alerte_mail_email'];
$auteur = utf8_decode($userInfoFrom['prenom'] . ' ' . $userInfoFrom['nom'] . ' (' . $userInfoFrom['login'] . ')');
$subject = CopixI18N::get('minimail|minimail.mail.alert.subject', array($auteur));
$message = str_replace('<br />', "\n", CopixI18N::get('minimail|minimail.mail.alert.body', array($auteur, CopixUrl::get('minimail||getMessage', array('id' => $newMp->id)), CopixUrl::get())));
$from = CopixConfig::get('default|mailFrom');
$fromName = CopixConfig::get('default|mailFromName');
$cc = $cci = '';
$monMail = new CopixTextEMail($to, $cc, $cci, $subject, $message);
$send = $monMail->send($from, $fromName);
}
}
// ======= Fin alerte mail ===============
}
$res = $newMp->id;
if ($res) {
$plugStats = CopixPluginRegistry::get("stats|stats");
$plugStats->setParams(array('module' => 'minimail', 'action' => 'sendMinimail', 'objet_a' => $res));
}
}
return $res;
}
示例11: afterSave
public function afterSave($data)
{
//print_r($data);
//exit();
if ($data['sendOption'] == 'immediately') {
//make queue id
$qid = Prefs::makeQueueId();
$qdate = new MongoDate();
$cid = $data['_id']->toString();
$cmp = Campaign::find($cid);
$cmp->push(array('queueId' => $qid, 'queueInitTime' => $qdate));
$cmp->save();
//put into queue
//set history
} else {
}
return $data;
}
示例12: _createContent
/**
* Affiche la fiche détaillée d'un utilisateur (login, nom, prénom...)
*
* @author Christophe Beyer <cbeyer@cap-tic.fr>
* @since 2006/01/04
* @param string $type Type de personne (USER_ELE, USER_ELE...)
* @param integer $id Id
*/
public function _createContent(&$toReturn)
{
$annuaireService =& CopixClassesFactory::Create('annuaire|AnnuaireService');
$type = $this->getParam('type') ? $this->getParam('type') : NULL;
$id = $this->getParam('id') ? $this->getParam('id') : NULL;
$canWrite = $canView = false;
if ($type && $id) {
$usr = Kernel::getUserInfo($type, $id);
$usr['type_nom'] = Kernel::Code2Name($usr['type']);
//Kernel::myDebug($usr);
$droits = Kernel::getUserInfoMatrix($usr);
$canView = $droits['voir'];
$canWrite = $droits['communiquer'];
if ($canView) {
// Avatar
$avatar = '';
if (isset($usr['user_id'])) {
$avatar = Prefs::get('prefs', 'avatar', $usr['user_id']);
}
$usr['avatar'] = $avatar ? CopixConfig::get('prefs|avatar_path') . $avatar : '';
$parents = $enfants = array();
if ($type == 'USER_ELE') {
// Pour un élève, on cherche ses parents
$parents = $annuaireService->getParentsFromEleve($id);
} elseif ($type == 'USER_RES') {
// Pour un parent, on cherche ses enfants
$enfants = $annuaireService->getEnfantsFromParent($id);
}
} else {
$usr = $parents = $enfants = false;
}
$tpl = new CopixTpl();
$tpl->assign('usr', $usr);
$tpl->assign('canWrite', $canWrite);
$tpl->assign('parents', $parents);
$tpl->assign('enfants', $enfants);
$toReturn = $tpl->fetch('getuserprofilzone.tpl');
}
return true;
}
示例13: updateStock
public static function updateStock($data, $positive = 'available', $negative = 'deleted')
{
//print_r($data);
$outlets = $data['outlets'];
$outletNames = $data['outletNames'];
$addQty = $data['addQty'];
$adjustQty = $data['adjustQty'];
unset($data['outlets']);
unset($data['outletNames']);
unset($data['addQty']);
unset($data['adjustQty']);
$productDetail = Product::find($data['id'])->toArray();
// year and month used fro batchnumber
$year = date('Y', time());
$month = date('m', time());
for ($i = 0; $i < count($outlets); $i++) {
$su = array('outletId' => $outlets[$i], 'outletName' => $outletNames[$i], 'productId' => $data['id'], 'SKU' => $data['SKU'], 'productDetail' => $productDetail, 'status' => $positive, 'createdDate' => new MongoDate(), 'lastUpdate' => new MongoDate());
if ($addQty[$i] > 0) {
for ($a = 0; $a < $addQty[$i]; $a++) {
$su['_id'] = str_random(8);
$batchnumber = Prefs::GetBatchId($data['SKU'], $year, $month);
$su['_id'] = $data['SKU'] . '|' . $batchnumber;
$history = array('datetime' => new MongoDate(), 'action' => 'init', 'price' => $productDetail['priceRegular'], 'status' => $su['status'], 'outletName' => $su['outletName']);
$su['history'] = array($history);
Stockunit::insert($su);
}
}
if ($adjustQty[$i] > 0) {
$td = Stockunit::where('outletId', $outlets[$i])->where('productId', $data['id'])->where('SKU', $data['SKU'])->where('status', 'available')->orderBy('createdDate', 'asc')->take($adjustQty[$i])->get();
foreach ($td as $d) {
$d->status = $negative;
$d->lastUpdate = new MongoDate();
$d->save();
$history = array('datetime' => new MongoDate(), 'action' => 'delete', 'price' => $d->priceRegular, 'status' => $d->status, 'outletName' => $d->outletName);
$d->push('history', $history);
}
}
}
}
示例14: execute
function execute()
{
if (Config::lpStoreRedis) {
$key = get_class() . ':' . $this->typeID . ',' . $this->qty;
$cache = json_decode($this->bpcCache->get($key), true);
if (empty($cache) || empty($cache['manDetails']) || $cache['version'] != Db::$dbName) {
$cache = array('version' => Db::$dbName, 'manDetails' => $this->performQuery());
$this->bpcCache->set($key, json_encode($cache));
}
} else {
$cache = array('version' => Db::$dbName, 'manDetails' => $this->performQuery());
}
# set price info for manufacturing materials
foreach ($cache['manDetails'] as &$manItem) {
try {
$price = new Price(Emdr::get($manItem['typeID']));
$manItem['price'] = $price->{Prefs::get('marketMat')}[0];
$manItem['totPrice'] = $manItem['price'] * $manItem['totQty'];
} catch (Exception $e) {
array_push($this->noCache, $manItem['typeName']);
}
}
return $cache['manDetails'];
}
示例15: fire
/**
* Execute the console command.
*
* @return mixed
*/
public function fire()
{
$logistic_id = 'CGKN00027';
$logistic = Logistic::where('consignee_olshop_cust', '=', $logistic_id)->first();
if (Prefs::isRunning($this->name)) {
$l = array();
$l['ts'] = new MongoDate();
$l['error'] = 'process already running';
$l['consignee_logistic_id'] = $logistic->logistic_code;
$l['consignee_olshop_cust'] = $logistic_id;
Threeplstatuserror::insert($l);
die('process already running');
}
$orders = Shipment::where('awb', '!=', '')->where('bucket', '=', Config::get('jayon.bucket_tracker'))->where(function ($sq) {
$sq->where('status', '!=', 'delivered')->where('status', '!=', 'undelivered')->where('status', '!=', 'canceled')->where('status', '!=', 'returned');
})->where('logistic_type', '=', 'external')->where('consignee_olshop_cust', '=', $logistic_id)->get();
$res = array();
print 'count ' . count($orders->toArray());
if ($orders && count($orders->toArray()) > 0) {
$req = array();
foreach ($orders as $ord) {
//$req[] = array('order_id'=>$ord->no_sales_order.'-'.$ord->consignee_olshop_orderid,'awb'=>$ord->awb);
$req[] = array('order_id' => $ord->consignee_olshop_orderid, 'awb' => $ord->consignee_olshop_orderid);
}
$client = new GuzzleClient();
//TO DO : Send data in chunk
$reqchunks = array_chunk($req, 100);
foreach ($reqchunks as $rq) {
$this->sendData($rq, $client, $logistic, $logistic_id);
}
} else {
print 'Empty order list' . "\r\n";
}
$actor = $this->name;
Event::fire('log.api', array('JayaStatusDaemon', 'get', $actor, 'JAYA STATUS PULL'));
}