Minor - format code

pull/3399/head
Julio Montoya 5 years ago
parent adde7f5ebf
commit 6788494355
  1. 17
      main/cron/archive_table_records.php
  2. 3
      main/exercise/hotspot.class.php
  3. 2
      main/exercise/hotspot_actionscript.as.php
  4. 2
      main/install/install.lib.php
  5. 4
      plugin/mindmap/uninstall.php

@ -63,7 +63,7 @@ foreach ($tables as $table) {
$sql = "INSERT INTO $tableArchive SELECT * FROM $table WHERE $pk >= $min AND $pk < $max";
file_put_contents(
$logFile,
"Moving rows $min to ".($max-1)." to $tableArchive. Starting at ".date('Y-m-d H:i:s')."\n",
"Moving rows $min to ".($max - 1)." to $tableArchive. Starting at ".date('Y-m-d H:i:s')."\n",
FILE_APPEND
);
$res = Database::query($sql);
@ -112,13 +112,14 @@ file_put_contents(
);
/**
* Returns the name of the primary key column for the given table
* Returns the name of the primary key column for the given table.
*
* @param string $table The name of the table
*
* @return string The column name of the primary key
*/
function getPKFromTable($table) {
function getPKFromTable($table)
{
$sql = "SELECT k.column_name
FROM information_schema.table_constraints t
JOIN information_schema.key_column_usage k
@ -129,20 +130,23 @@ function getPKFromTable($table) {
$res = Database::query($sql);
if (Database::num_rows($res) > 0) {
$row = Database::fetch_assoc($res);
return $row['column_name'];
}
return '';
}
/**
* Check a table exists and create it if it doesn't
* Check a table exists and create it if it doesn't.
*
* @param string $table The table to check/create
* @param string $table The table to check/create
* @param string $templateTable The model from which this table should be created
*
* @return bool True if it exists *or* it could be created, false if there was an error at create time
*/
function checkAndCreateTable($table, $templateTable) {
function checkAndCreateTable($table, $templateTable)
{
$sqlCheck = "SHOW TABLES LIKE '$table'";
$res = Database::query($sqlCheck);
if (Database::num_rows($res) > 0) {
@ -151,6 +155,7 @@ function checkAndCreateTable($table, $templateTable) {
} else {
$sqlCreate = "CREATE TABLE $table like $templateTable";
$res = Database::query($sqlCreate);
return $res;
}
}

@ -105,12 +105,11 @@ class HotSpot extends Question
}
/**
* @inheritDoc
* {@inheritdoc}
*/
public function return_header(Exercise $exercise, $counter = null, $score = [])
{
return parent::return_header($exercise, $counter, $score)
.'<table><tr><td><table class="table">';
}
}

@ -128,7 +128,7 @@ $attemptInfo = Database::select(
$course_id,
api_get_user_id(),
'incomplete',
]
],
],
'order' => 'exe_id DESC',
'limit' => 1,

@ -1698,7 +1698,7 @@ function display_configuration_parameter(
[
'class' => 'form-control',
'size' => FORM_FIELD_DISPLAY_LENGTH,
'maxlength' => MAX_FORM_FIELD_LENGTH
'maxlength' => MAX_FORM_FIELD_LENGTH,
]
)
.$eyeForPassword."</div>";

@ -1,7 +1,9 @@
<?php
/* For license terms, see /license.txt */
require_once 'mindmap_plugin.class.php';
if(!api_is_platform_admin()){
if (!api_is_platform_admin()) {
die('You must have admin permissions to install plugins');
}
MindmapPlugin::create()->uninstall();

Loading…
Cancel
Save