本文整理汇总了PHP中sfGuardUserPeer::doSelect方法的典型用法代码示例。如果您正苦于以下问题:PHP sfGuardUserPeer::doSelect方法的具体用法?PHP sfGuardUserPeer::doSelect怎么用?PHP sfGuardUserPeer::doSelect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sfGuardUserPeer
的用法示例。
在下文中一共展示了sfGuardUserPeer::doSelect方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: executeJsonList
public function executeJsonList(sfWebRequest $request)
{
$isAjax = $request->isXmlHttpRequest();
//if(!$isAjax) return $this->redirect('@homepage')
$c = new Criteria();
$users = sfGuardUserPeer::doSelect($c);
$elements = array();
foreach ($users as $user) {
$elements[] = $user->toArray();
}
$return = array('data' => $elements);
$result = json_encode($return);
$this->getResponse()->setHttpHeader('Content-type', 'application/json');
return $this->renderText($result);
}
示例2: retrieveByPKs
/**
* Retrieve multiple objects by pkey.
*
* @param array $pks List of primary keys
* @param PropelPDO $con the connection to use
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function retrieveByPKs($pks, PropelPDO $con = null)
{
if ($con === null) {
$con = Propel::getConnection(sfGuardUserPeer::DATABASE_NAME, Propel::CONNECTION_READ);
}
$objs = null;
if (empty($pks)) {
$objs = array();
} else {
$criteria = new Criteria(sfGuardUserPeer::DATABASE_NAME);
$criteria->add(sfGuardUserPeer::ID, $pks, Criteria::IN);
$objs = sfGuardUserPeer::doSelect($criteria, $con);
}
return $objs;
}
示例3: foreach
<tbody>
<?php
foreach ($odwiedz_list as $odwiedziny) {
?>
<tr>
<td><a href="<?php
echo url_for('odwiedziny/show?id=' . $odwiedziny->getId());
?>
"><?php
echo $odwiedziny->getId();
?>
</a></td>
<td><?php
$c = new Criteria();
$c->add(sfGuardUserPeer::ID, $odwiedziny->getPracownik());
$prac = sfGuardUserPeer::doSelect($c);
echo $prac[0];
?>
</td>
<td><?php
echo $odwiedziny->getRozpoczecie();
?>
</td>
<td><?php
echo $odwiedziny->getZakonczenie();
?>
</td>
<td><?php
echo '<input type="checkbox", disabled="disabled", name="wykonane"';
if ($odwiedziny->getWykonane() == 1) {
示例4: executeIndex
public function executeIndex(sfWebRequest $request)
{
$this->sfGuardUsers = sfGuardUserPeer::doSelect(new Criteria());
}
示例5: executeAbout
public function executeAbout(sfWebRequest $request)
{
$c = new Criteria();
//1,2,4,5,6,7
$c->add(sfGuardUserPeer::ID, 1);
$c->addOr(sfGuardUserPeer::ID, 2);
$c->addOr(sfGuardUserPeer::ID, 4);
$c->addOr(sfGuardUserPeer::ID, 5);
$c->addOr(sfGuardUserPeer::ID, 22);
$c->addOr(sfGuardUserPeer::ID, 7);
$c->addOr(sfGuardUserPeer::ID, 31);
$c->addOr(sfGuardUserPeer::ID, 180);
$c->addOr(sfGuardUserPeer::ID, 9);
$c->addOr(sfGuardUserPeer::ID, 738);
$c->addOr(sfGuardUserPeer::ID, 27);
$c->addOr(sfGuardUserPeer::ID, 447);
$c->addAscendingOrderByColumn(sfGuardUserPeer::ID);
$users = sfGuardUserPeer::doSelect($c);
$this->users = array();
foreach ($users as $user) {
$this->users[$user->getid()] = $user;
}
$this->title = sfContext::getInstance()->getI18N()->__('Sobre Voota - Quiénes somos', array());
$this->response->setTitle($this->title);
}
示例6: getNonRegisteredUsers
/**
* gets Non Facebook-registered Users
*
* @return sfGuardUser[]
* @author fabriceb
* @since 2009-05-17
*/
public function getNonRegisteredUsers()
{
$c = new Criteria();
$c->addJoin(sfGuardUserPeer::ID, $this->getSfGuardUserforeignKeyColumn());
$c->add($this->getEmailHashColumn(), null, Criteria::ISNULL);
$sfGuardUsers = sfGuardUserPeer::doSelect($c);
return $sfGuardUsers;
}
示例7: executeSignin
public function executeSignin($request)
{
$this->op = $request->getParameter('op');
//echo $this->op;
//die;
$dialog = $request->getParameter('dialog', false);
/* IF FB CONNECT */
if ($this->op == 'fbc' && ($facebook_uid = VoFacebook::getUid())) {
//echo "FBC";die;
$c = new Criteria();
$c->addJoin(SfGuardUserProfilePeer::USER_ID, SfGuardUserPeer::ID);
$c->add(SfGuardUserProfilePeer::FACEBOOK_UID, $facebook_uid);
$sfGuardUser = SfGuardUserPeer::doSelectOne($c);
if (!$sfGuardUser instanceof sfGuardUser) {
// Comprobación de que no existe ya el usuario con ese username (bug #734)
$c = new Criteria();
$c->add(sfGuardUserPeer::USERNAME, 'Facebook_' . $facebook_uid);
$existingUser = sfGuardUserPeer::doSelectOne($c);
if ($existingUser) {
$existingUser->setUsername('Facebook_' . $facebook_uid . '-' . time());
$existingUser->save();
}
$sfGuardUser = new sfGuardUser();
$sfGuardUser->setUsername('Facebook_' . $facebook_uid);
$sfGuardUser->save();
$voProfile = $sfGuardUser->getProfile();
$vanityUrl = SfVoUtil::encodeVanity('Facebook_' . $facebook_uid);
$voProfile->setFacebookUid($facebook_uid);
if (!$voProfile->getNombre()) {
$data = VoFacebook::getData($voProfile->getFacebookUid());
$voProfile->setNombre($data->first_name);
$voProfile->setApellidos($data->last_name);
}
$c2 = new Criteria();
$c2->add(SfGuardUserProfilePeer::VANITY, "{$vanityUrl}%", Criteria::LIKE);
$usuariosLikeMe = SfGuardUserProfilePeer::doSelect($c2);
$counter = 0;
foreach ($usuariosLikeMe as $usuarioLikeMe) {
if (preg_match("/^Facebook_{$facebook_uid}-([0-9]*)/i", $usuarioLikeMe->getVanity(), $matches)) {
$curIdx = $matches[1];
if ($curIdx > $counter) {
$counter = $curIdx + 1;
}
} else {
$counter++;
}
}
$voProfile->setVanity("{$vanityUrl}" . ($counter == 0 ? '' : "-{$counter}"));
$voProfile->setMailsComentarios(0);
$voProfile->setMailsNoticias(0);
$voProfile->setMailsContacto(0);
$voProfile->setMailsSeguidor(0);
$voProfile->save();
}
$this->getUser()->signin($sfGuardUser, false);
$signinUrl = sfConfig::get('app_sf_guard_plugin_success_signin_url', $this->getUser()->getReferer('@homepage'));
$this->redirect($signinUrl);
}
/* FI FB CONNECT */
$this->registrationform = new RegistrationForm();
$this->signinform = new SigninForm();
if ($request->isMethod('post') && !$dialog) {
// Register
if ($this->op == 'r') {
$this->registrationform = new RegistrationForm();
$this->registrationform->bind($request->getParameter('registration'));
if ($this->registrationform->isValid()) {
$user = new sfGuardUser();
$user->setUsername($this->registrationform->getValue('username'));
$user->setPassword($this->registrationform->getValue('password'));
$user->setIsActive(0);
$user->setCreatedAt(time());
$c = new Criteria();
$c->add(sfGuardUserPeer::USERNAME, $user->getUsername());
sfGuardUserPeer::doInsert($user);
$user = sfGuardUserPeer::doSelect($c);
if (count($user) == 1) {
$profile = $user[0]->getProfile();
$profile->setNombre($this->registrationform->getValue('nombre'));
$profile->setApellidos($this->registrationform->getValue('apellidos'));
$profile->setPresentacion($this->registrationform->getValue('presentacion'));
$profile->setAnonymous($this->registrationform->getValue('anonymous'));
$profile->setCodigo(util::generateUID());
/* Generar vanity */
if ($profile->getVanity() == '') {
$vanityUrl = SfVoUtil::encodeVanity($profile->getNombre() . "-" . $profile->getApellidos());
$c2 = new Criteria();
$c2->add(SfGuardUserProfilePeer::VANITY, "{$vanityUrl}%", Criteria::LIKE);
$c2->add(SfGuardUserProfilePeer::ID, $user[0]->getId(), Criteria::NOT_EQUAL);
$usuariosLikeMe = SfGuardUserProfilePeer::doSelect($c2);
$counter = 0;
foreach ($usuariosLikeMe as $usuarioLikeMe) {
$counter++;
}
$profile->setVanity("{$vanityUrl}" . ($counter == 0 ? '' : "-{$counter}"));
}
/* Fin Generar vanity */
sfGuardUserProfilePeer::doInsert($profile);
$this->sendWelcome($user[0]);
$this->user = $user[0];
//.........这里部分代码省略.........
示例8: error_reporting
<?php
error_reporting(E_ALL);
include_once "../../config/ProjectConfiguration.class.php";
$configuration = ProjectConfiguration::getApplicationConfiguration('frontend', 'prod', true);
$sfContext = sfContext::createInstance($configuration);
$sfContext->dispatch();
$res = ldap_connect("ldaps://ldap.tufts.edu/", 636);
$anon = ldap_bind($res);
if (!$anon) {
echo ldap_error($res) . "\n";
exit;
}
$users = sfGuardUserPeer::doSelect(new Criteria());
foreach ($users as $u) {
if (strpos($u->getUserName(), "@tufts.edu") !== false) {
$c = new Criteria();
$c->add(sfGuardUserProfilePeer::USER_ID, $u->getId());
$profile = sfGuardUserProfilePeer::doSelectOne($c);
$result = ldap_search($res, "dc=tufts,dc=edu", "mail=" . $u->getUserName());
$info = ldap_get_entries($res, $result);
if ($info["count"]) {
echo $info[0]["uid"][0] . "\n";
$profile->setEmail(trim($u->getUserName()));
$profile->save();
$u->setUserName(trim($info[0]["uid"][0]));
$u->save();
} else {
echo $u->getUserName() . " not found! \n";
$profile->setEmail("");
$profile->save();
示例9: execute
protected function execute($arguments = array(), $options = array())
{
$frequencies = array('D' => 'Daily', 'W' => 'Weekly', 'M' => 'Monthly');
$frequency = $arguments['frequency'];
if (!array_key_exists($frequency, $frequencies)) {
logline(sprintf('Invalid frequency %s use [D|W|M]', $frequency));
exit;
}
sfLoader::loadHelpers('Partial', 'My');
$context = sfContext::createInstance($this->configuration);
$stop_watch = new StopWatch();
$stop_watch->start();
logline(sprintf('Started processing %s mails.', $frequencies[$frequency]));
$databaseManager = new sfDatabaseManager($this->configuration);
$c1 = new Criteria();
$c1->addJoin(sfGuardUserPeer::ID, ReportPeer::USER_ID);
$c1->add(ReportPeer::MAIL_FREQUENCY, $frequency);
$c1->setDistinct();
$users = sfGuardUserPeer::doSelect($c1);
foreach ($users as $user) {
$c = new Criteria();
$c->add(ReportPeer::USER_ID, $user->getId());
$c->add(ReportPeer::MAIL_FREQUENCY, $frequency);
$reports = ReportPeer::doSelect($c);
logline(sprintf("There are %s reports to process.", sizeof($reports)));
$sfGuardUserProfile = $user->getsfGuardUserProfiles();
$sfGuardUserProfile = $sfGuardUserProfile[0];
$connection = new Swift_Connection_SMTP('mail.sis-nav.com', 25);
$connection->setUsername('umut.utkan@sistemas.com.tr');
$connection->setPassword('gahve123');
$mailer = new Swift($connection);
$message = new Swift_Message(sprintf("Goole Volume - %s notifications.", $frequencies[$frequency]));
$images = array();
foreach ($reports as $report) {
// $rtn = ReportPeer::_getReportChart(
// $report, date('Y-m-d', strtotime(date('Ymd') . ' -1 months')),
// date('Y-m-d', strtotime(date('Y-m-d') . ' +1 days')),
// QueryResultPeer::FREQUENCY_DAY, new MailChartDecorator());
$rtn = ReportPeer::_getReportChartt($report, new MailChartDecorator());
$data = $rtn['values'];
$line_chart = $rtn['chart'];
$image_path = $local_url = sfConfig::get('app_web_images') . '/' . $line_chart->__toString();
$images[$report->getTitle()] = new Swift_Message_Image(new Swift_File($image_path));
$imageReferences = array();
foreach ($images as $name => $image) {
$imageReferences[$name] = $message->attach($image);
}
$mailContext = array('data' => $data, 'full_name' => $sfGuardUserProfile->getFullName(), 'report' => $report, 'images' => $imageReferences);
}
try {
$message->attach(new Swift_Message_Part(get_partial('mail/mailReportHtmlBody', $mailContext), 'text/html'));
$message->attach(new Swift_Message_Part(get_partial('mail/mailReportTextBody', $mailContext), 'text/plain'));
$mailer->send($message, $sfGuardUserProfile->getEmail(), 'info@googlevolume.com');
$mailer->disconnect();
} catch (Exception $e) {
logline(sprintf('Exception while sending email to %s about %s. %s', $sfGuardUserProfile->getEmail(), $report->getTitle(), $e));
$mailer->disconnect();
}
logline(sprintf('Sent mail to %s.', $sfGuardUserProfile->getEmail()));
}
logline(sprintf("Finished processing."));
$stop_watch->end();
logline(sprintf('Execution time: %s seconds.', $stop_watch->getTime()));
logline(sprintf('!!!!!CAN RUN %s TIMES A DAY!!!!!', 24 * 60 * 60 / ($stop_watch->getTime() == 0 ? 1 : $stop_watch->getTime())));
}