Format code, fix psalm

pull/3924/head
Julio Montoya 4 years ago
parent 91e04cd9b0
commit f7e68c22cd
  1. 1
      public/main/admin/user_linking_requests.php
  2. 2
      public/main/gradebook/gradebook_display_certificate.php
  3. 6
      public/main/inc/lib/ScheduledAnnouncement.php
  4. 2
      public/main/inc/lib/SkillModel.php
  5. 6
      public/main/inc/lib/career.lib.php
  6. 7
      public/main/inc/lib/certificate.lib.php
  7. 6
      public/main/inc/lib/grade_model.lib.php
  8. 6
      public/main/inc/lib/timeline.lib.php
  9. 2
      public/main/mySpace/myStudents.php
  10. 4
      public/main/survey/create_meeting.php
  11. 1
      src/CoreBundle/DataProvider/Extension/MessageExtension.php
  12. 1
      src/CoreBundle/Entity/User.php
  13. 6
      src/CoreBundle/Migrations/Schema/V200/Version20170626122900.php

@ -30,7 +30,6 @@ if (!empty($action) && $hrm && $assignedId) {
if ($request) { if ($request) {
$request->setRelationType(USER_RELATION_TYPE_RRHH); $request->setRelationType(USER_RELATION_TYPE_RRHH);
$request->setLastEdit(api_get_utc_datetime(null, null, true));
$em->persist($request); $em->persist($request);
$em->flush(); $em->flush();

@ -202,7 +202,7 @@ if ('delete' === $action) {
$check = Security::check_token('get'); $check = Security::check_token('get');
if ($check) { if ($check) {
$certificate = new Certificate($_GET['certificate_id']); $certificate = new Certificate($_GET['certificate_id']);
$result = $certificate->delete(true); $result = $certificate->deleteCertificate(true);
Security::clear_token(); Security::clear_token();
if (true == $result) { if (true == $result) {
echo Display::return_message(get_lang('Certificate removed'), 'confirmation'); echo Display::return_message(get_lang('Certificate removed'), 'confirmation');

@ -24,16 +24,16 @@ class ScheduledAnnouncement extends Model
} }
/** /**
* @param array $where_conditions * @param array $options
* *
* @return array * @return array
*/ */
public function get_all($where_conditions = []) public function get_all($options = [])
{ {
return Database::select( return Database::select(
'*', '*',
$this->table, $this->table,
['where' => $where_conditions, 'order' => 'subject ASC'] ['where' => $options, 'order' => 'subject ASC']
); );
} }

@ -563,7 +563,7 @@ class SkillModel extends Model
} }
/* Deletes a skill */ /* Deletes a skill */
public function delete($skill_id) public function delete($id)
{ {
/*$params = array('skill_id' => $skill_id); /*$params = array('skill_id' => $skill_id);

@ -40,16 +40,16 @@ class Career extends Model
} }
/** /**
* @param array $where_conditions * @param array $options
* *
* @return array * @return array
*/ */
public function get_all($where_conditions = []) public function get_all($options = [])
{ {
return Database::select( return Database::select(
'*', '*',
$this->table, $this->table,
['where' => $where_conditions, 'order' => 'name ASC'] ['where' => $options, 'order' => 'name ASC']
); );
} }

@ -139,7 +139,7 @@ class Certificate extends Model
* *
* @return bool * @return bool
*/ */
public function delete($force_delete = false) public function deleteCertificate($force_delete = false)
{ {
$delete_db = false; $delete_db = false;
if (!empty($this->certificate_data)) { if (!empty($this->certificate_data)) {
@ -484,17 +484,18 @@ class Certificate extends Model
*/ */
public function generateQRImage($text, $path) public function generateQRImage($text, $path)
{ {
throw new \Exception('generateQRImage');
if (!empty($text) && !empty($path)) { if (!empty($text) && !empty($path)) {
$qrCode = new QrCode($text); $qrCode = new QrCode($text);
//$qrCode->setEncoding('UTF-8'); //$qrCode->setEncoding('UTF-8');
$qrCode->setSize(120); $qrCode->setSize(120);
$qrCode->setMargin(5); $qrCode->setMargin(5);
$qrCode->setWriterByName('png'); /*$qrCode->setWriterByName('png');
$qrCode->setErrorCorrectionLevel(ErrorCorrectionLevel::MEDIUM()); $qrCode->setErrorCorrectionLevel(ErrorCorrectionLevel::MEDIUM());
$qrCode->setForegroundColor(['r' => 0, 'g' => 0, 'b' => 0, 'a' => 0]); $qrCode->setForegroundColor(['r' => 0, 'g' => 0, 'b' => 0, 'a' => 0]);
$qrCode->setBackgroundColor(['r' => 255, 'g' => 255, 'b' => 255, 'a' => 0]); $qrCode->setBackgroundColor(['r' => 255, 'g' => 255, 'b' => 255, 'a' => 0]);
$qrCode->setValidateResult(false); $qrCode->setValidateResult(false);
$qrCode->writeFile($path); $qrCode->writeFile($path);*/
return true; return true;
} }

@ -19,16 +19,16 @@ class GradeModel extends Model
} }
/** /**
* @param array $where_conditions * @param array $options
* *
* @return array * @return array
*/ */
public function get_all($where_conditions = []) public function get_all($options = [])
{ {
return Database::select( return Database::select(
'*', '*',
$this->table, $this->table,
['where' => $where_conditions, 'order' => 'name ASC'] ['where' => $options, 'order' => 'name ASC']
); );
} }

@ -59,16 +59,16 @@ class Timeline extends Model
} }
/** /**
* @param array $where_conditions * @param array $options
* *
* @return array * @return array
*/ */
public function get_all($where_conditions = []) public function get_all($options = [])
{ {
return Database::select( return Database::select(
'*', '*',
$this->table, $this->table,
['where' => $where_conditions, 'order' => 'headline ASC'] ['where' => $options, 'order' => 'headline ASC']
); );
} }

@ -514,7 +514,7 @@ switch ($action) {
); );
if ($myCertificate) { if ($myCertificate) {
$certificate = new Certificate($myCertificate['id'], $studentId); $certificate = new Certificate($myCertificate['id'], $studentId);
$certificate->delete(true); $certificate->deleteCertificate(true);
} }
// Create new one // Create new one
$certificate = new Certificate(0, $studentId); $certificate = new Certificate(0, $studentId);

@ -115,10 +115,6 @@ if ($form->validate()) {
if (isset($values[$name]) && !empty($values[$name])) { if (isset($values[$name]) && !empty($values[$name])) {
$date = $values[$name]; $date = $values[$name];
if (empty($date)) {
continue;
}
$start = $name.'_time_range_start'; $start = $name.'_time_range_start';
$end = $name.'_time_range_end'; $end = $name.'_time_range_end';

@ -77,7 +77,6 @@ final class MessageExtension implements QueryCollectionExtensionInterface //, Qu
'promoted' => Message::MESSAGE_TYPE_PROMOTED, 'promoted' => Message::MESSAGE_TYPE_PROMOTED,
'wallPost' => Message::MESSAGE_TYPE_WALL, 'wallPost' => Message::MESSAGE_TYPE_WALL,
'conversation' => Message::MESSAGE_STATUS_CONVERSATION, 'conversation' => Message::MESSAGE_STATUS_CONVERSATION,
]); ]);
} }
} }

@ -2398,7 +2398,6 @@ class User implements UserInterface, EquatableInterface, ResourceInterface, Reso
? 0 ? 0
: max( : max(
$categoryCourses->map( $categoryCourses->map(
/** @var CourseRelUser $courseRelUser */
function ($courseRelUser) { function ($courseRelUser) {
return $courseRelUser->getSort(); return $courseRelUser->getSort();
} }

@ -199,17 +199,17 @@ class Version20170626122900 extends AbstractMigrationChamilo
$this->addSql('ALTER TABLE user_rel_user CHANGE friend_user_id friend_user_id INT DEFAULT NULL'); $this->addSql('ALTER TABLE user_rel_user CHANGE friend_user_id friend_user_id INT DEFAULT NULL');
if ($table->hasColumn('last_edit')) { if ($table->hasColumn('last_edit')) {
$this->addSql("UPDATE user_rel_user SET last_edit = NOW() WHERE last_edit IS NULL"); $this->addSql('UPDATE user_rel_user SET last_edit = NOW() WHERE last_edit IS NULL');
} }
if (!$table->hasColumn('created_at')) { if (!$table->hasColumn('created_at')) {
$this->addSql("ALTER TABLE user_rel_user ADD created_at DATETIME NOT NULL COMMENT '(DC2Type:datetime)"); $this->addSql("ALTER TABLE user_rel_user ADD created_at DATETIME NOT NULL COMMENT '(DC2Type:datetime)");
$this->addSql("UPDATE user_rel_user SET created_at = last_edit"); $this->addSql('UPDATE user_rel_user SET created_at = last_edit');
} }
if (!$table->hasColumn('updated_at')) { if (!$table->hasColumn('updated_at')) {
$this->addSql("ALTER TABLE user_rel_user ADD updated_at DATETIME NOT NULL COMMENT '(DC2Type:datetime)"); $this->addSql("ALTER TABLE user_rel_user ADD updated_at DATETIME NOT NULL COMMENT '(DC2Type:datetime)");
$this->addSql("UPDATE user_rel_user SET updated_at = last_edit"); $this->addSql('UPDATE user_rel_user SET updated_at = last_edit');
} }
if (!$table->hasForeignKey('FK_DBF650A893D1119E')) { if (!$table->hasForeignKey('FK_DBF650A893D1119E')) {

Loading…
Cancel
Save