From 59c87597b0bc351465e5238c4b18a08037d0c282 Mon Sep 17 00:00:00 2001
From: Gabriel <gabrielhruiz@gmail.com>
Date: Mon, 15 Jun 2015 15:27:39 +0200
Subject: [PATCH] implements_comments_lines_2504591-11

---
 smartest/smartest.board.inc | 51 +++++++++++++++++++++++++++++++++++++++++----
 smartest/smartest.install   |  9 ++++++++
 smartest/smartest.module    | 18 +++++++++++-----
 smartest/smartest.pages.inc | 27 +++++++++++++++++-------
 4 files changed, 88 insertions(+), 17 deletions(-)

diff --git a/smartest/smartest.board.inc b/smartest/smartest.board.inc
index 3576bcf..f111f1c 100644
--- a/smartest/smartest.board.inc
+++ b/smartest/smartest.board.inc
@@ -1,5 +1,8 @@
 <?php
 
+/*
+* Dashboard form
+*/
 function smartest_dashboard_form($form, &$form_state){
 	drupal_add_css(drupal_get_path('module', 'smartest') . '/styles/graph-menu.css');
 	$form['#attached']['js'] = array(
@@ -62,7 +65,7 @@ function smartest_dashboard_form($form, &$form_state){
 		    'effect' => 'fade',
     	),
 	);
-	//Add a new widget form
+	//Add a new widget form.
 	$form['dashboard']['add-widget'] = array(
     	'#prefix' => '<div id="add-widget">',
     	'#suffix' => '</div>',
@@ -239,6 +242,9 @@ function smartest_dashboard_form($form, &$form_state){
 	return $form;
 }
 
+/*
+* Active chart/cloud options.
+*/
 function smartest_active_div_callback($form, &$form_state){
 	if ($form_state['values']['widget-type'] == 'chart') {
 		$form['add-widget']['wrapper']['clouds']['#access'] = FALSE;
@@ -252,14 +258,23 @@ function smartest_active_div_callback($form, &$form_state){
 	return $form['add-widget']['wrapper'];
 }
 
+/*
+* Active add widget menu.
+*/
 function smartest_add_widget_callback($form, &$form_state){
 	return $form['add-widget'];
 }
 
+/*
+* Active add page menu.
+*/
 function smartest_add_page_callback($form, &$form_state){
 	return $form['add-page'];
 }
 
+/*
+* Change page on dashboard.
+*/
 function smartest_load_submit($form, &$form_state){
 	db_update('smartest_cache')
 		->fields(array('type' => $form_state['values']['select']))
@@ -267,6 +282,9 @@ function smartest_load_submit($form, &$form_state){
 		->execute();
 }
 
+/*
+* Save the new page defined as new dashboard.
+*/
 function smartest_add_page_form_submit($form, &$form_state){
 	 $fields = array(
 	    'title'    => 'header' . $form_state['values']['title-page'],
@@ -288,13 +306,16 @@ function smartest_add_page_form_submit($form, &$form_state){
 		->execute();	
 }
 
+/*
+* Save new widgwt defined.
+*/
 function smartest_add_widget_form_submit($form, &$form_state){
-	//n_element value
+	//n_element value.
   	$number = $form_state['values']['selectnumofmod'];
   	if ($number == 'ALL') {
     	$number = '1000';
   	}
-  	//modules array value
+  	//modules array value.
   	$selected = "";
   	foreach ($form_state['values']['selectmodules'] as $select => $value) {
     	if ($value !== 0) {
@@ -304,7 +325,7 @@ function smartest_add_widget_form_submit($form, &$form_state){
   	if ($selected == "") {
     	$selected =  'ALL';
   	}
-  	//criterias values
+  	//criterias values.
   	$widget_type = $form_state['values']['widget-type'];
   	$creteria1 = '';
   	$criteria2 = '';
@@ -333,6 +354,9 @@ function smartest_add_widget_form_submit($form, &$form_state){
     	->execute();
 }
 
+/*
+* Remove on dashboard a specific widget.
+*/
 function smartest_close_widget_form_submit($form, &$form_state){
 	$title = $form_state['triggering_element']['#array_parents'][3];
 	drupal_set_message(t('Widget with name "' . $title . '" was removed.'));
@@ -341,7 +365,11 @@ function smartest_close_widget_form_submit($form, &$form_state){
 			->execute();
 }
 
+/*
+* Update stats of modules.
+*/
 function update_statistics(){
+  set_time_limit(300);
   $modules = module_list();
   $files = array();
   foreach ($modules as $module => $value) {
@@ -367,10 +395,16 @@ function update_statistics(){
   update_coverage();
 }
 
+/*
+* Update or calculate the enabled modules coverage.
+*/
 function update_coverage(){
 
 }
 
+/*
+* Defined a widget of graphical type.
+*/
 class GraphicalWidget {
 	public $modules = array();
 	public $title;
@@ -520,6 +554,9 @@ class GraphicalWidget {
 	}
 }
 
+/*
+* Defined a widget of cloud type.
+*/
 class CloudWidget {
 	public $title;
 	public $size_criteria;
@@ -755,6 +792,9 @@ class HeaderWidget{
 	}
 }
 
+/*
+* relationship acronym-criteria
+*/
 function identify_criteria($criteria){
 	$result = '';
 	switch ($criteria) {
@@ -792,6 +832,9 @@ function identify_criteria($criteria){
 	return $result;
 }
 
+/*
+* Time format.
+*/
 function get_format_time($seconds){
   $sec = 0;
   $min = 0;
diff --git a/smartest/smartest.install b/smartest/smartest.install
index 32e5667..7ff2e03 100644
--- a/smartest/smartest.install
+++ b/smartest/smartest.install
@@ -1,5 +1,8 @@
 <?php
 
+/**
+ * Implements hook_uninstall().
+ */
 function smartest_uninstall(){
   echo "<script>console.log( 'Debug Objects: YES' );</script>";
   drupal_set_message(t('Uninstall smartest module'));
@@ -14,6 +17,9 @@ function smartest_uninstall(){
   drupal_uninstall_schema('smartest');
 }
 
+/**
+ * Implements hook_enabled().
+ */
 function smartest_enable() {
   //Check if table exists, if not install the schema.
   if(db_table_exists('smartest_statistic') == FALSE) {
@@ -485,6 +491,9 @@ function smartest_install() {
     ->execute();
 }
 
+/**
+ * Calculate stats of enabled modules.
+ */
 function calculate_stats() {
   $modules = module_list();
   $files = array();
diff --git a/smartest/smartest.module b/smartest/smartest.module
index b59001e..666c0f7 100644
--- a/smartest/smartest.module
+++ b/smartest/smartest.module
@@ -38,15 +38,15 @@ function smartest_theme() {
 /**
  * Implements hook_requeriments().
  *
- * PHPLOC version: 2.1.3
- * latests commit: 4b21840dfe
+ * PHPLOC version: 2.1.3.
+ * latests commit: 4b21840dfe.
  * branch: master.
  *
- * Expected to be extracted into 'sites/all/libraries/phploc'
+ * Expected to be extracted into 'sites/all/libraries/phploc'.
  */
 function smartest_requirements($phase) {
   $requirements = array();
-  // Ensure translations do not break at install time
+  // Ensure translations do not break at install time.
   $t = get_t();
 
   $requirements['phploc'] = array(
@@ -67,6 +67,9 @@ function smartest_requirements($phase) {
   return $requirements;
 }
 
+/*
+* Autoload information about SmarTest libraries.
+*/
 function smartest_autoload_info() {
   $path = libraries_get_path('phploc');
   return array(
@@ -77,6 +80,9 @@ function smartest_autoload_info() {
   );
 }
 
+/**
+ * Implements hook_phploc_libraries_Info().
+ */
 function smartest_phploc_libraries_info() {
 
   // Expected to be extracted into 'sites/all/libraries/simple'.
@@ -180,7 +186,6 @@ function smartest_menu() {
       array('_smartest_batch_operation', array($test_list, $test_id, getdate())),
     ),
     'finished' => '_simpletest_batch_finished',
-    //'progress_message' => drupal_render(drupal_get_form('smartest_execution_form')),
     'css' => array(drupal_get_path('module', 'simpletest') . '/simpletest.css',
                   drupal_get_path('module', 'smartest') . '/styles/batch.css'),
     'init_message' => t('Processing test @num of @max - %test.', array('%test' => $info['name'], '@num' => '1', '@max' => count($test_list))),
@@ -342,6 +347,9 @@ function _smartest_batch_operation($test_list_init, $test_id, $date, &$context)
   }
 }
 
+/*
+* Update excution time of tests modules.
+*/
 function update_test_times(){
   $query = db_select('smartest_times')
     ->fields('smartest_times', array('test_group', 'time'))
diff --git a/smartest/smartest.pages.inc b/smartest/smartest.pages.inc
index f9c6e5d..333819e 100644
--- a/smartest/smartest.pages.inc
+++ b/smartest/smartest.pages.inc
@@ -139,7 +139,7 @@ function smartest_test_form($form) {
  * Provides settings form for LabsIsaTest variables.
  *
  * @ingroup forms
- * @see LabsIsaTest_settings_form_validate()
+ * @see LabsIsaTest_settings_form_validate().
  */
 function smartest_settings_form($form, &$form_state) {
 
@@ -200,6 +200,9 @@ function smartest_settings_form($form, &$form_state) {
   return system_settings_form($form);
 }
 
+/*
+* Save the priorization selected in a configuration.
+*/
 function smartest_priorization_form_submit($form, &$form_state){
   $order = 'DESC';
   if ($form_state['values']['reverse'] == 1) {
@@ -288,6 +291,9 @@ function smartest_test_form_submit($form, &$form_state) {
   }
 }
 
+/*
+* Result form of test executions.
+*/
 function smartest_result_form($form, &$form_state, $test_id) {
   smartest_clean_database();
   // Make sure there are test results to display and a re-run is not being performed.
@@ -424,6 +430,9 @@ function smartest_result_form($form, &$form_state, $test_id) {
   return $form;
 }
 
+/*
+* Get test executions.
+*/
 function smartest_result_get($test_id) {
   $results = db_select('simpletest')
     ->fields('simpletest')
@@ -456,14 +465,16 @@ function smartest_result_get($test_id) {
   return $test_results;
 }
 
+/*
+* clean SmarTest database.
+*/
 function smartest_clean_database() {
   db_truncate('smartest')->execute();
 }
 
-//------------------
-//--PRIORIZATION----
-//------------------
-
+/*
+* Define a test priorization.
+*/
 class Priorization {
   /*
   *$modules: List of classes to be tested
@@ -666,9 +677,9 @@ function theme_smartest_test_table($variables) {
   }
 }
 
-//------------------------
-//--------Messages--------
-//------------------------
+/*
+* Define the messages for to be loaded dynamically.
+*/
 class Messages {
   static $LOC_TITLE                 = 'PRIORIZATION BY LINES OF CODE';
   static $LOC_DESCRIPTION_ASC       = 'Modules with a lower number of LoC (Lines of Code) have higher priority to execute their tests.';
-- 
1.9.5.msysgit.0

