User PHP Class Code Examples

This page contains top rated real world PHP examples of class User extracted from open source projects. You can rate examples to help us improve the quality of examples

Example #1
Show file File: AclProvider.php Project: dstansby/camdram
0
 /**
  * Approve a request to access a show.
  *
  * Unlike other entities, (societies and venues), users can request
  * to access a show. This function approves the request, and dispatches
  * a Camdram-specific event that is used to trigger sending of emails.
  */
 public function approveShowAccess(Show $show, User $user, User $granter)
 {
     $persist = false;
     $ace_repo = $this->entityManager->getRepository('ActsCamdramSecurityBundle:AccessControlEntry');
     $existing_ace = $ace_repo->findAce($user, $show);
     /* Don't add a new ACE if the user is already able to access
      * the resource. 
      */
     if ($existing_ace == null) {
         $ace = $ace_repo->findAceRequest($user, $show);
         if ($ace != null) {
             $ace->setGrantedBy($granter)->setGrantedAt(new \DateTime())->setType('show');
             $persist = true;
         }
     } elseif ($existing_ace->getRevokedBy() != null) {
         /* Assume that we're undoing the previous revokation. */
         $existing_ace->setRevokedBy(null)->setRevokedAt(null)->setGrantedBy($granter)->setGrantedAt(new \DateTime());
         $persist = true;
     }
     if ($persist == true) {
         $this->entityManager->persist($ace);
         $this->entityManager->flush();
         /* Send a Camdram-specific event that should trigger an email
          * notification.
          */
         $this->eventDispatcher->dispatch(CamdramSecurityEvents::ACE_CREATED, new AccessControlEntryEvent($ace));
     }
 }
Example #2
Show file File: broken.inc.php Project: Ekleog/platal
0
 public function __construct(User $sender, User $user, $email, $comment = null)
 {
     parent::__construct($sender, false, 'broken');
     $this->m_user =& $user;
     $this->m_comment = trim($comment);
     $this->m_email = $email;
 }
Example #3
Show file File: BuddyMatching.php Project: ESNFranceG33kTeam/sf_buddysystem
0
 private function getScore(User $user, User $buddyPotentiel)
 {
     $score = 0;
     $coefAttenuation = $this->nationaliteEqual($user, $buddyPotentiel);
     if ($coefAttenuation > 0) {
         $score += self::NATIONALITE_VALUE / $coefAttenuation;
     }
     $coefAttenuation = $this->disponibiliteEqual($user, $buddyPotentiel);
     if ($coefAttenuation > 0) {
         $score += self::DISPONIBILITE_VALUE / $coefAttenuation;
     }
     if ($this->langageEqual($user->getLanguages(), $buddyPotentiel->getLanguages())) {
         $score += self::LANGAGE_VALUE;
     }
     if ($this->universiteEqual($user->getUniversite(), $buddyPotentiel->getUniversite())) {
         $score += self::UNIVERSITE_VALUE;
     }
     $coefAttenuation = $this->sexeEqual($user->getSexe(), $user->getSexewanted(), $buddyPotentiel->getSexe(), $buddyPotentiel->getSexewanted());
     if ($coefAttenuation > 0) {
         $score += self::SEXE_VALUE / $coefAttenuation;
     }
     if ($this->hobbiesEqual($user->getHobbies(), $buddyPotentiel->getHobbies())) {
         $score += self::HOBBIES_VALUE;
     }
     if ($this->doOneTimeEqual($user->getDoOneTime(), $buddyPotentiel->getDoOneTime())) {
         $score += self::DOONETIME_VALUE;
     }
     return $score;
 }
Example #4
Show file File: paiement.class.php Project: Samara94/dolibarr
0
 /**
  *    Information sur l'objet
  *    
  *    @param   int     $id      id du paiement dont il faut afficher les infos
  *    @return  void
  */
 function info($id)
 {
     $sql = 'SELECT p.rowid, p.datec, p.fk_user_creat, p.fk_user_modif, p.tms';
     $sql .= ' FROM ' . MAIN_DB_PREFIX . 'paiement as p';
     $sql .= ' WHERE p.rowid = ' . $id;
     dol_syslog(get_class($this) . '::info', LOG_DEBUG);
     $result = $this->db->query($sql);
     if ($result) {
         if ($this->db->num_rows($result)) {
             $obj = $this->db->fetch_object($result);
             $this->id = $obj->rowid;
             if ($obj->fk_user_creat) {
                 $cuser = new User($this->db);
                 $cuser->fetch($obj->fk_user_creat);
                 $this->user_creation = $cuser;
             }
             if ($obj->fk_user_modif) {
                 $muser = new User($this->db);
                 $muser->fetch($obj->fk_user_modif);
                 $this->user_modification = $muser;
             }
             $this->date_creation = $this->db->jdate($obj->datec);
             $this->date_modification = $this->db->jdate($obj->tms);
         }
         $this->db->free($result);
     } else {
         dol_print_error($this->db);
     }
 }
Example #5
Show file File: facture.class.php Project: Samara94/dolibarr
0
 /**
  *	Load miscellaneous information for tab "Info"
  *
  *	@param  int		$id		Id of object to load
  *	@return	void
  */
 function info($id)
 {
     $sql = 'SELECT c.rowid, datec, date_valid as datev, tms as datem,';
     $sql .= ' fk_user_author, fk_user_valid';
     $sql .= ' FROM ' . MAIN_DB_PREFIX . 'facture as c';
     $sql .= ' WHERE c.rowid = ' . $id;
     $result = $this->db->query($sql);
     if ($result) {
         if ($this->db->num_rows($result)) {
             $obj = $this->db->fetch_object($result);
             $this->id = $obj->rowid;
             if ($obj->fk_user_author) {
                 $cuser = new User($this->db);
                 $cuser->fetch($obj->fk_user_author);
                 $this->user_creation = $cuser;
             }
             if ($obj->fk_user_valid) {
                 $vuser = new User($this->db);
                 $vuser->fetch($obj->fk_user_valid);
                 $this->user_validation = $vuser;
             }
             $this->date_creation = $this->db->jdate($obj->datec);
             $this->date_modification = $this->db->jdate($obj->datem);
             $this->date_validation = $this->db->jdate($obj->datev);
             // Should be in log table
         }
         $this->db->free($result);
     } else {
         dol_print_error($this->db);
     }
 }
Example #6
Show file File: UserManager.php Project: shakaran/powerline-server
0
 public function updateProfileFull(User $user, User $new)
 {
     $this->updateProfileCommon($user, $new);
     $this->updateProfileDemographics($user, $new);
     $this->updateProfilePolitical($user, $new);
     return $user;
 }
Example #7
Show file File: CreateUserCommand.php Project: crow1796/technologyRIS
0
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     $user;
     switch (strtolower($this->option('permission'))) {
         case 'admin':
             $user = new User();
             $user->username = 'admin';
             $user->password = Hash::make('admin');
             $user->email = 'admin@example.com';
             $user->firstname = 'Joshua';
             $user->middlename = 'Agagdan';
             $user->lastname = 'Tundag';
             Permission::first()->users()->save($user);
             $user->save();
             break;
         case 'user':
             $user = new User();
             $user->username = 'ododz';
             $user->password = Hash::make('gwapodz');
             $user->email = 'odozd@gwapodz.com';
             $user->firstname = 'Ododz';
             $user->middlename = 'G';
             $user->lastname = 'Gwapodz';
             Permission::all()->get(1)->users()->save($user);
             $user->save();
             break;
     }
     return $user;
 }
Example #8
Show file File: address.class.php Project: Samara94/dolibarr
0
 /**
  * 	Charge les informations d'ordre info dans l'objet societe
  *
  *  @param  int		$id     id de la societe a charger
  *  @return	void
  */
 function info($id)
 {
     $sql = "SELECT s.rowid, s.nom as name, datec as date_creation, tms as date_modification,";
     $sql .= " fk_user_creat, fk_user_modif";
     $sql .= " FROM " . MAIN_DB_PREFIX . "societe as s";
     $sql .= " WHERE s.rowid = " . $id;
     $result = $this->db->query($sql);
     if ($result) {
         if ($this->db->num_rows($result)) {
             $obj = $this->db->fetch_object($result);
             $this->id = $obj->rowid;
             if ($obj->fk_user_creat) {
                 $cuser = new User($this->db);
                 $cuser->fetch($obj->fk_user_creat);
                 $this->user_creation = $cuser;
             }
             if ($obj->fk_user_modif) {
                 $muser = new User($this->db);
                 $muser->fetch($obj->fk_user_modif);
                 $this->user_modification = $muser;
             }
             $this->ref = $obj->name;
             $this->date_creation = $this->db->jdate($obj->date_creation);
             $this->date_modification = $this->db->jdate($obj->date_modification);
         }
         $this->db->free($result);
     } else {
         dol_print_error($this->db);
     }
 }
Example #9
Show file File: DoctrineORMAdapterTest.php Project: 3lolo/lr_app
0
 public function setUp()
 {
     parent::setUp();
     $schemaTool = new SchemaTool($this->entityManager);
     $schemaTool->createSchema(array($this->entityManager->getClassMetadata('Pagerfanta\\Tests\\Adapter\\DoctrineORM\\User'), $this->entityManager->getClassMetadata('Pagerfanta\\Tests\\Adapter\\DoctrineORM\\Group'), $this->entityManager->getClassMetadata('Pagerfanta\\Tests\\Adapter\\DoctrineORM\\Person')));
     $this->user1 = $user = new User();
     $this->user2 = $user2 = new User();
     $group1 = new Group();
     $group2 = new Group();
     $group3 = new Group();
     $user->groups[] = $group1;
     $user->groups[] = $group2;
     $user->groups[] = $group3;
     $user2->groups[] = $group1;
     $author1 = new Person();
     $author1->name = 'Foo';
     $author1->biography = 'Baz bar';
     $author2 = new Person();
     $author2->name = 'Bar';
     $author2->biography = 'Bar baz';
     $this->entityManager->persist($user);
     $this->entityManager->persist($user2);
     $this->entityManager->persist($group1);
     $this->entityManager->persist($group2);
     $this->entityManager->persist($group3);
     $this->entityManager->persist($author1);
     $this->entityManager->persist($author2);
     $this->entityManager->flush();
 }
Example #10
Show file File: UsersTableSeeder.php Project: centaurustech/Bankame
0
 public function run()
 {
     DB::table('users')->delete();
     $user = new User();
     $user->email = 'admin@gmail.com';
     $user->password = Hash::make('adminadmin');
     $user->username = 'admin';
     $user->admin = TRUE;
     $user->active = TRUE;
     $user->save();
     $user = new User();
     $user->email = 'editor@gmail.com';
     $user->password = Hash::make('editoreditor');
     $user->username = 'editor';
     $user->admin = FALSE;
     $user->editor = TRUE;
     $user->active = TRUE;
     $user->save();
     $user = new User();
     $user->email = 'usuario@gmail.com';
     $user->password = Hash::make('usuariousuario');
     $user->username = 'usuario';
     $user->admin = FALSE;
     $user->editor = FALSE;
     $user->active = TRUE;
     $user->save();
 }
Example #11
Show file File: UserTableSeeder.php Project: Helg18/mailer_laravel
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $admin = new User();
     $admin->name = 'Henry Leon Gomez';
     $admin->email = 'helg18@gmail.com';
     $admin->password = bcrypt("henry");
     $admin->perfil = 'root';
     $admin->save();
     $accesos = new Accesos();
     $accesos->user_id = $admin->id;
     $accesos->create = 1;
     $accesos->read = 1;
     $accesos->update = 1;
     $accesos->delete = 1;
     for ($i = 0; $i < 25; $i++) {
         $usuario = new User();
         $faker = Faker\Factory::create();
         $usuario->name = $faker->name;
         $usuario->email = $faker->email;
         $usuario->password = bcrypt($faker->name);
         $usuario->perfil = 'usuario';
         $usuario->save();
         $accesos = new Accesos();
         $accesos->user_id = $usuario->id;
         $accesos->create = 0;
         $accesos->read = 0;
         $accesos->update = 0;
         $accesos->delete = 0;
     }
 }
Example #12
Show file File: place.class.php Project: LionSystemsSolutions/El-Canelo-ERP
0
 /**
  *       Charge les informations d'ordre info dans l'objet societe
  *       @param     id     Id de la societe a charger
  */
 function info($id)
 {
     $sql = "SELECT rowid, name, datec, datea,";
     $sql .= " fk_user_c, fk_user_m";
     $sql .= " FROM " . MAIN_DB_PREFIX . "pos_places as s";
     $sql .= " WHERE rowid = " . $id;
     $result = $this->db->query($sql);
     if ($result) {
         if ($this->db->num_rows($result)) {
             $obj = $this->db->fetch_object($result);
             $this->id = $obj->rowid;
             if ($obj->fk_user_c) {
                 $cuser = new User($this->db);
                 $cuser->fetch($obj->fk_user_c);
                 $this->user_creation = $cuser;
             }
             if ($obj->fk_user_m) {
                 $muser = new User($this->db);
                 $muser->fetch($obj->fk_user_m);
                 $this->user_modification = $muser;
             }
             $this->name = $obj->name;
             $this->date_creation = $this->db->jdate($obj->datec);
             $this->date_modification = $this->db->jdate($obj->datea);
         }
         $this->db->free($result);
     } else {
         dol_print_error($this->db);
     }
 }
Example #13
Show file File: LoadUserData.php Project: phecho/gitonomy
0
 /**
  * @inheritdoc
  */
 public function load(ObjectManager $manager)
 {
     $adminRole = $this->getReference('role-admin');
     $projectCreatorRole = $this->getReference('role-project-creator');
     $users = array();
     $lead = new User('lead', 'Lead', 'Europe/Paris');
     $lead->addGlobalRole($projectCreatorRole);
     $lead->createEmail('lead@example.org', true);
     $this->setPassword($lead, 'lead');
     $users[] = $lead;
     $charlie = new User('charlie', 'Visitor', 'Europe/Paris');
     $charlie->createEmail('charlie@example.org');
     $this->setPassword($charlie, 'charlie');
     $users[] = $charlie;
     $alice = new User('alice', 'Alice', 'Europe/Paris');
     $alice->addGlobalRole($projectCreatorRole);
     $alice->createEmail('alice@example.org', true);
     $alice->createEmail('derpina@example.org');
     $this->setPassword($alice, 'alice');
     $users[] = $alice;
     $bob = new User('bob', 'Bob', 'Europe/Paris');
     $bob->createEmail('bob@example.org', true);
     $this->setPassword($bob, 'bob');
     $users[] = $bob;
     $inactive = new User('inactive', 'Inactive', 'Europe/Paris');
     $inactive->createEmail('inactive@example.org', true)->createActivationToken();
     $inactive->createActivationToken();
     $users[] = $inactive;
     foreach ($users as $user) {
         $manager->persist($user);
         $this->setReference('user-' . $user->getUsername(), $user);
     }
     $manager->flush();
 }
Example #14
Show file File: CalendarEventInviteesTypeTest.php Project: Maksold/platform
0
 public function testBuildView()
 {
     $firstUser = new User();
     $firstUser->setUsername('1');
     $secondUser = new User();
     $secondUser->setUsername('2');
     $firstCalendar = new Calendar();
     $firstCalendar->setOwner($firstUser);
     $secondCalendar = new Calendar();
     $secondCalendar->setOwner($secondUser);
     $firstEvent = new CalendarEvent();
     $firstEvent->setCalendar($firstCalendar);
     $secondEvent = new CalendarEvent();
     $secondEvent->setCalendar($secondCalendar);
     $formData = [$firstEvent, $secondEvent];
     $transformedData = [$firstUser, $secondUser];
     $form = $this->getMock('Symfony\\Component\\Form\\FormInterface');
     $form->expects($this->once())->method('getData')->will($this->returnValue($formData));
     $this->transformer->expects($this->once())->method('transform')->with($formData)->will($this->returnValue($transformedData));
     $converter = $this->getMock('Oro\\Bundle\\FormBundle\\Autocomplete\\ConverterInterface');
     $converter->expects($this->any())->method('convertItem')->will($this->returnCallback([$this, 'convertEvent']));
     $formView = new FormView();
     $expectedSelectedData = json_encode([$this->convertEvent($firstUser), $this->convertEvent($secondUser)]);
     $this->type->buildView($formView, $form, ['converter' => $converter]);
     $this->assertArrayHasKey('attr', $formView->vars);
     $this->assertEquals(['data-selected-data' => $expectedSelectedData], $formView->vars['attr']);
 }
Example #15
Show file File: LoadUserData.php Project: DevMaster112/flora
0
 /**
  * {@inheritDoc}
  */
 public function load(ObjectManager $manager)
 {
     $user = new User();
     $user->setUsername('admin');
     $user->setEmail('admin@test.com');
     $user->setEnabled(true);
     $user->setRoles(array('ROLE_SUPER_ADMIN'));
     $encoder = $this->container->get('security.encoder_factory')->getEncoder($user);
     $user->setPassword($encoder->encodePassword('admin', $user->getSalt()));
     $manager->persist($user);
     $manager->flush();
     $this->addReference('user1', $user);
     $user = new User();
     $user->setUsername('o.quiroz');
     $user->setEmail('o.temp@hotmail.com');
     $user->setEnabled(true);
     $user->setRoles(array('ROLE_SUPER_ADMIN'));
     $encoder = $this->container->get('security.encoder_factory')->getEncoder($user);
     $user->setPassword($encoder->encodePassword('o.quiroz', $user->getSalt()));
     $manager->persist($user);
     $manager->flush();
     $this->addReference('user2', $user);
     $user = new User();
     $user->setUsername('n.ramirez');
     $user->setEmail('n.temp@hotmail.com');
     $user->setEnabled(true);
     $user->setRoles(array('ROLE_SUPER_ADMIN'));
     $encoder = $this->container->get('security.encoder_factory')->getEncoder($user);
     $user->setPassword($encoder->encodePassword('o.quiroz', $user->getSalt()));
     $manager->persist($user);
     $manager->flush();
     $this->addReference('user3', $user);
 }
Example #16
Show file File: product.class.php Project: Samara94/dolibarr
0
 /**
  *  Load information for tab info
  *
  *  @param  int		$id     Id of thirdparty to load
  *  @return	void
  */
 function info($id)
 {
     $sql = "SELECT p.rowid, p.ref, p.datec as date_creation, p.tms as date_modification,";
     $sql .= " p.fk_user_author, p.fk_user_modif";
     $sql .= " FROM " . MAIN_DB_PREFIX . $this->table_element . " as p";
     $sql .= " WHERE p.rowid = " . $id;
     $result = $this->db->query($sql);
     if ($result) {
         if ($this->db->num_rows($result)) {
             $obj = $this->db->fetch_object($result);
             $this->id = $obj->rowid;
             if ($obj->fk_user_author) {
                 $cuser = new User($this->db);
                 $cuser->fetch($obj->fk_user_author);
                 $this->user_creation = $cuser;
             }
             if ($obj->fk_user_modif) {
                 $muser = new User($this->db);
                 $muser->fetch($obj->fk_user_modif);
                 $this->user_modification = $muser;
             }
             $this->ref = $obj->ref;
             $this->date_creation = $this->db->jdate($obj->date_creation);
             $this->date_modification = $this->db->jdate($obj->date_modification);
         }
         $this->db->free($result);
     } else {
         dol_print_error($this->db);
     }
 }
Example #17
Show file File: contrat.class.php Project: LionSystemsSolutions/El-Canelo-ERP
0
 /**
  *  Charge les informations d'ordre info dans l'objet contrat
  *
  *  @param  int		$id     id du contrat a charger
  *  @return	void
  */
 function info($id)
 {
     $sql = "SELECT c.rowid, c.ref, c.datec, c.date_cloture,";
     $sql .= " c.tms as date_modification,";
     $sql .= " fk_user_author, fk_user_cloture";
     $sql .= " FROM " . MAIN_DB_PREFIX . "contrat as c";
     $sql .= " WHERE c.rowid = " . $id;
     $result = $this->db->query($sql);
     if ($result) {
         if ($this->db->num_rows($result)) {
             $obj = $this->db->fetch_object($result);
             $this->id = $obj->rowid;
             if ($obj->fk_user_author) {
                 $cuser = new User($this->db);
                 $cuser->fetch($obj->fk_user_author);
                 $this->user_creation = $cuser;
             }
             if ($obj->fk_user_cloture) {
                 $cuser = new User($this->db);
                 $cuser->fetch($obj->fk_user_cloture);
                 $this->user_cloture = $cuser;
             }
             $this->ref = !$obj->ref ? $obj->rowid : $obj->ref;
             $this->date_creation = $this->db->jdate($obj->datec);
             $this->date_modification = $this->db->jdate($obj->date_modification);
             $this->date_cloture = $this->db->jdate($obj->date_cloture);
         }
         $this->db->free($result);
     } else {
         dol_print_error($this->db);
     }
 }
Example #18
Show file File: chargesociales.class.php Project: LionSystemsSolutions/El-Canelo-ERP
0
 /**
  * 	Charge les informations d'ordre info dans l'objet entrepot
  *
  *  @param	int		$id     Id of social contribution
  *  @return	int				<0 if KO, >0 if OK
  */
 function info($id)
 {
     $sql = "SELECT e.rowid, e.tms as datem, e.date_creation as datec, e.date_valid as datev";
     $sql .= " FROM " . MAIN_DB_PREFIX . "chargesociales as e";
     $sql .= " WHERE e.rowid = " . $id;
     dol_syslog(get_class($this) . "::info sql=" . $sql);
     $result = $this->db->query($sql);
     if ($result) {
         if ($this->db->num_rows($result)) {
             $obj = $this->db->fetch_object($result);
             $this->id = $obj->rowid;
             if ($obj->fk_user_author) {
                 $cuser = new User($this->db);
                 $cuser->fetch($obj->fk_user_author);
                 $this->user_creation = $cuser;
             }
             if ($obj->fk_user_valid) {
                 $vuser = new User($this->db);
                 $vuser->fetch($obj->fk_user_valid);
                 $this->user_validation = $vuser;
             }
             $this->date_creation = $this->db->jdate($obj->datec);
             $this->date_modification = $this->db->jdate($obj->datem);
             $this->date_validation = $this->db->jdate($obj->datev);
         }
         $this->db->free($result);
     } else {
         dol_print_error($this->db);
     }
 }
Example #19
Show file File: contact.class.php Project: Samara94/dolibarr
0
 /**
  *  Charge les informations sur le contact, depuis la base
  *
  *  @param		int		$id      Id du contact a charger
  *  @return		void
  */
 function info($id)
 {
     $sql = "SELECT c.rowid, c.datec as datec, c.fk_user_creat,";
     $sql .= " c.tms as tms, c.fk_user_modif";
     $sql .= " FROM " . MAIN_DB_PREFIX . "socpeople as c";
     $sql .= " WHERE c.rowid = " . $this->db->escape($id);
     $resql = $this->db->query($sql);
     if ($resql) {
         if ($this->db->num_rows($resql)) {
             $obj = $this->db->fetch_object($resql);
             $this->id = $obj->rowid;
             if ($obj->fk_user_creat) {
                 $cuser = new User($this->db);
                 $cuser->fetch($obj->fk_user_creat);
                 $this->user_creation = $cuser;
             }
             if ($obj->fk_user_modif) {
                 $muser = new User($this->db);
                 $muser->fetch($obj->fk_user_modif);
                 $this->user_modification = $muser;
             }
             $this->date_creation = $this->db->jdate($obj->datec);
             $this->date_modification = $this->db->jdate($obj->tms);
         }
         $this->db->free($resql);
     } else {
         print $this->db->error();
     }
 }
Example #20
Show file File: Task.class.php Project: z445056647/phx-svns
0
 /**
  * 按状态和分页获取任务列表
  * @param int $status
  * @param string $limit
  */
 public function GetList($status, $limit = NULL)
 {
     $cond = array('status' => $status);
     if (!Passport::IsAdmin()) {
         $user = new User();
         $perms = $user->getPerms(Passport::GetLoginUid());
         if (count($perms) > 0) {
             $cond['pid'] = array_keys($perms);
         } else {
             $cond['uid'] = Passport::GetLoginUid();
         }
     }
     $list = $this->findBy($cond, $this->primary_key, $limit, null, 'send_time desc, id desc');
     // 查询 username 字段
     $uids = array();
     foreach ($list as $item) {
         $uids[] = $item['uid'];
     }
     $uids = array_unique($uids);
     $user = new User();
     $user_list = $user->gets($uids);
     foreach ($list as &$item) {
         $item['username'] = if_null($user_list[$item['uid']]['username'], 'uid: ' . $item['uid']);
         unset($item);
     }
     return $list;
 }
Example #21
Show file File: deplacement.class.php Project: Samara94/dolibarr
0
 /**
  * Information on record
  *
  * @param	int		$id      Id of record
  * @return	void
  */
 function info($id)
 {
     $sql = 'SELECT c.rowid, c.datec, c.fk_user_author, c.fk_user_modif,';
     $sql .= ' c.tms';
     $sql .= ' FROM ' . MAIN_DB_PREFIX . 'deplacement as c';
     $sql .= ' WHERE c.rowid = ' . $id;
     dol_syslog(get_class($this) . '::info', LOG_DEBUG);
     $result = $this->db->query($sql);
     if ($result) {
         if ($this->db->num_rows($result)) {
             $obj = $this->db->fetch_object($result);
             $this->id = $obj->rowid;
             if ($obj->fk_user_author) {
                 $cuser = new User($this->db);
                 $cuser->fetch($obj->fk_user_author);
                 $this->user_creation = $cuser;
             }
             if ($obj->fk_user_modif) {
                 $muser = new User($this->db);
                 $muser->fetch($obj->fk_user_modif);
                 $this->user_modification = $muser;
             }
             $this->date_creation = $this->db->jdate($obj->datec);
             $this->date_modification = $this->db->jdate($obj->tms);
         }
         $this->db->free($result);
     } else {
         dol_print_error($this->db);
     }
 }
Example #22
Show file File: supplier_proposal.class.php Project: Samara94/dolibarr
0
 /**
  *	Object SupplierProposal Information
  *
  * 	@param	int		$id		Proposal id
  *  @return	void
  */
 function info($id)
 {
     $sql = "SELECT c.rowid, ";
     $sql .= " c.datec, c.date_valid as datev, c.date_cloture as dateo,";
     $sql .= " c.fk_user_author, c.fk_user_valid, c.fk_user_cloture";
     $sql .= " FROM " . MAIN_DB_PREFIX . "supplier_proposal as c";
     $sql .= " WHERE c.rowid = " . $id;
     $result = $this->db->query($sql);
     if ($result) {
         if ($this->db->num_rows($result)) {
             $obj = $this->db->fetch_object($result);
             $this->id = $obj->rowid;
             $this->date_creation = $this->db->jdate($obj->datec);
             $this->date_validation = $this->db->jdate($obj->datev);
             $this->date_cloture = $this->db->jdate($obj->dateo);
             $cuser = new User($this->db);
             $cuser->fetch($obj->fk_user_author);
             $this->user_creation = $cuser;
             if ($obj->fk_user_valid) {
                 $vuser = new User($this->db);
                 $vuser->fetch($obj->fk_user_valid);
                 $this->user_validation = $vuser;
             }
             if ($obj->fk_user_cloture) {
                 $cluser = new User($this->db);
                 $cluser->fetch($obj->fk_user_cloture);
                 $this->user_cloture = $cluser;
             }
         }
         $this->db->free($result);
     } else {
         dol_print_error($this->db);
     }
 }
Example #23
Show file File: payment.class.php Project: LionSystemsSolutions/El-Canelo-ERP
0
 function info($id)
 {
     $sql = 'SELECT c.rowid, c.datec, c.fk_user_creat, c.fk_user_modif,';
     $sql .= ' c.tms';
     $sql .= ' FROM ' . MAIN_DB_PREFIX . 'paiement as c';
     $sql .= ' WHERE c.rowid = ' . $id;
     dol_syslog(get_class($this) . '::info sql=' . $sql);
     $result = $this->db->query($sql);
     if ($result) {
         if ($this->db->num_rows($result)) {
             $obj = $this->db->fetch_object($result);
             $this->id = $obj->rowid;
             if ($obj->fk_user_creat) {
                 $cuser = new User($this->db);
                 $cuser->fetch($obj->fk_user_creat);
                 $this->user_creation = $cuser;
             }
             if ($obj->fk_user_modif) {
                 $muser = new User($this->db);
                 $muser->fetch($obj->fk_user_modif);
                 $this->user_modification = $muser;
             }
             $this->date_creation = $this->db->jdate($obj->datec);
             $this->date_modification = $this->db->jdate($obj->tms);
         }
         $this->db->free($result);
     } else {
         dol_print_error($this->db);
     }
 }
Example #24
Show file File: paiementfourn.class.php Project: LionSystemsSolutions/El-Canelo-ERP
0
 /**
  *	Information on object
  *
  *	@param	int		$id      Id du paiement dont il faut afficher les infos
  *	@return	void
  */
 function info($id)
 {
     $sql = 'SELECT c.rowid, datec, fk_user_author, tms';
     $sql .= ' FROM ' . MAIN_DB_PREFIX . 'paiementfourn as c';
     $sql .= ' WHERE c.rowid = ' . $id;
     $resql = $this->db->query($sql);
     if ($resql) {
         $num = $this->db->num_rows($resql);
         if ($num) {
             $obj = $this->db->fetch_object($resql);
             $this->id = $obj->rowid;
             if ($obj->fk_user_creat) {
                 $cuser = new User($this->db);
                 $cuser->fetch($obj->fk_user_creat);
                 $this->user_creation = $cuser;
             }
             if ($obj->fk_user_modif) {
                 $muser = new User($this->db);
                 $muser->fetch($obj->fk_user_modif);
                 $this->user_modification = $muser;
             }
             $this->date_creation = $this->db->jdate($obj->datec);
             $this->date_modification = $this->db->jdate($obj->tms);
         }
         $this->db->free($resql);
     } else {
         dol_print_error($this->db);
     }
 }
Example #25
Show file File: accountingaccount.class.php Project: Samara94/dolibarr
0
 /**
  * Information on record
  *
  * @param int $id of record
  * @return void
  */
 function info($id)
 {
     $sql = 'SELECT a.rowid, a.datec, a.fk_user_author, a.fk_user_modif, a.tms';
     $sql .= ' FROM ' . MAIN_DB_PREFIX . 'accounting_account as a';
     $sql .= ' WHERE a.rowid = ' . $id;
     dol_syslog(get_class($this) . '::info sql=' . $sql);
     $result = $this->db->query($sql);
     if ($result) {
         if ($this->db->num_rows($result)) {
             $obj = $this->db->fetch_object($result);
             $this->id = $obj->rowid;
             if ($obj->fk_user_author) {
                 $cuser = new User($this->db);
                 $cuser->fetch($obj->fk_user_author);
                 $this->user_creation = $cuser;
             }
             if ($obj->fk_user_modif) {
                 $muser = new User($this->db);
                 $muser->fetch($obj->fk_user_modif);
                 $this->user_modification = $muser;
             }
             $this->date_creation = $this->db->jdate($obj->datec);
             $this->date_modification = $this->db->jdate($obj->tms);
         }
         $this->db->free($result);
     } else {
         dol_print_error($this->db);
     }
 }
Example #26
Show file File: UsersTableSeeder.php Project: ganboonhong/ynote
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $user = new \App\User();
     $user->password = bcrypt('111111');
     $user->email = 'ganboonhong@gmail.com';
     $user->level = 100;
     $user->name = 'Francis';
     $user->description = 'Stay hungry, stay foolish.';
     $user->save();
     $user = new \App\User();
     $user->password = bcrypt('111111');
     $user->email = 'ganboonhong2@gmail.com';
     $user->level = 100;
     $user->name = 'Francis2';
     $user->description = 'Stay hungry, stay foolish.';
     $user->save();
     $user = new \App\User();
     $user->password = bcrypt('tom');
     $user->email = 'tom@gmail.com';
     $user->level = 100;
     $user->name = 'Tom';
     $user->save();
     $user = new \App\User();
     $user->password = bcrypt('admin');
     $user->email = 'admin@gmail.com';
     $user->level = 50;
     $user->name = 'Administrator';
     $user->save();
     $user = new \App\User();
     $user->password = bcrypt('guest');
     $user->email = 'guest@gmail.com';
     $user->level = 10;
     $user->name = 'Guest';
     $user->save();
 }
Example #27
Show file File: UserCalendarProviderTest.php Project: Maksold/platform
0
 public function testGetCalendarDefaultValues()
 {
     $organizationId = 1;
     $userId = 123;
     $calendarId = 20;
     $calendarIds = [10, 20];
     $calendar1 = new Calendar();
     ReflectionUtil::setId($calendar1, $calendarIds[0]);
     $user1 = new User();
     ReflectionUtil::setId($user1, $userId);
     $calendar1->setOwner($user1);
     $calendar2 = new Calendar();
     ReflectionUtil::setId($calendar2, $calendarIds[1]);
     $user2 = new User();
     ReflectionUtil::setId($user2, 456);
     $calendar2->setOwner($user2);
     $calendars = [$calendar1, $calendar2];
     $qb = $this->getMockBuilder('Doctrine\\ORM\\QueryBuilder')->disableOriginalConstructor()->getMock();
     $repo = $this->getMockBuilder('Doctrine\\ORM\\EntityRepository')->disableOriginalConstructor()->getMock();
     $repo->expects($this->once())->method('createQueryBuilder')->with('o')->will($this->returnValue($qb));
     $this->doctrineHelper->expects($this->once())->method('getEntityRepository')->with('OroCalendarBundle:Calendar')->will($this->returnValue($repo));
     $qb->expects($this->once())->method('select')->with('o, owner')->will($this->returnSelf());
     $qb->expects($this->once())->method('innerJoin')->with('o.owner', 'owner')->will($this->returnSelf());
     $qb->expects($this->once())->method('expr')->will($this->returnValue(new Expr()));
     $qb->expects($this->once())->method('where')->with(new Expr\Func('o.id IN', $calendarIds))->will($this->returnSelf());
     $query = $this->getMockBuilder('Doctrine\\ORM\\AbstractQuery')->disableOriginalConstructor()->setMethods(['getResult'])->getMockForAbstractClass();
     $qb->expects($this->once())->method('getQuery')->will($this->returnValue($query));
     $query->expects($this->once())->method('getResult')->will($this->returnValue($calendars));
     $this->entityNameResolver->expects($this->at(0))->method('getName')->with($this->identicalTo($user1))->will($this->returnValue('John Doo'));
     $this->entityNameResolver->expects($this->at(1))->method('getName')->with($this->identicalTo($user2))->will($this->returnValue('John Smith'));
     $result = $this->provider->getCalendarDefaultValues($organizationId, $userId, $calendarId, $calendarIds);
     $this->assertEquals([$calendarIds[0] => ['calendarName' => 'John Doo', 'userId' => $userId], $calendarIds[1] => ['calendarName' => 'John Smith', 'userId' => 456, 'removable' => false, 'canAddEvent' => true, 'canEditEvent' => true, 'canDeleteEvent' => true]], $result);
 }
Example #28
Show file File: fournisseur.facture.class.php Project: LionSystemsSolutions/El-Canelo-ERP
0
 /**
  *	Charge les informations d'ordre info dans l'objet facture
  *
  *	@param  int		$id       	Id de la facture a charger
  *	@return	void
  */
 function info($id)
 {
     $sql = 'SELECT c.rowid, datec, tms as datem,';
     $sql .= ' fk_user_author, fk_user_valid';
     $sql .= ' FROM ' . MAIN_DB_PREFIX . 'facture_fourn as c';
     $sql .= ' WHERE c.rowid = ' . $id;
     $result = $this->db->query($sql);
     if ($result) {
         if ($this->db->num_rows($result)) {
             $obj = $this->db->fetch_object($result);
             $this->id = $obj->rowid;
             if ($obj->fk_user_author) {
                 $cuser = new User($this->db);
                 $cuser->fetch($obj->fk_user_author);
                 $this->user_creation = $cuser;
             }
             if ($obj->fk_user_valid) {
                 $vuser = new User($this->db);
                 $vuser->fetch($obj->fk_user_valid);
                 $this->user_validation = $vuser;
             }
             $this->date_creation = $obj->datec;
             $this->date_modification = $obj->datem;
             //$this->date_validation   = $obj->datev; Should be stored in log table
         }
         $this->db->free($result);
     } else {
         dol_print_error($this->db);
     }
 }
Example #29
Show file File: LoadUserData.php Project: Jandersolutions/mautic
0
 /**
  * @param ObjectManager $manager
  */
 public function load(ObjectManager $manager)
 {
     $user = new User();
     $user->setFirstName('Admin');
     $user->setLastName('User');
     $user->setUsername('admin');
     $user->setEmail('admin@yoursite.com');
     $encoder = $this->container->get('security.encoder_factory')->getEncoder($user);
     $user->setPassword($encoder->encodePassword('mautic', $user->getSalt()));
     $user->setRole($this->getReference('admin-role'));
     $manager->persist($user);
     $manager->flush();
     $this->addReference('admin-user', $user);
     $user = new User();
     $user->setFirstName('Sales');
     $user->setLastName('User');
     $user->setUsername('sales');
     $user->setEmail('sales@yoursite.com');
     $encoder = $this->container->get('security.encoder_factory')->getEncoder($user);
     $user->setPassword($encoder->encodePassword('mautic', $user->getSalt()));
     $user->setRole($this->getReference('sales-role'));
     $manager->persist($user);
     $manager->flush();
     $this->addReference('sales-user', $user);
 }
Frequently Used Methods