[moodle] / moodle / mod / data / lib.php Repository:

Diff of /moodle/mod/data/lib.php

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.151, Fri Apr 11 11:59:41 2008 WST revision 1.152, Mon Apr 14 06:22:57 2008 WST

By skodak:

MDL-14342 fixed wrong quotes; merged from MOODLE_19_STABLE

# Line 40  Line 40 
40      function data_field_base($field=0, $data=0) {   // Field or data or both, each can be id or object      function data_field_base($field=0, $data=0) {   // Field or data or both, each can be id or object
41    
42          if (empty($field) && empty($data)) {          if (empty($field) && empty($data)) {
43              print_error('Programmer error: You must specify field and/or data when defining field class. ');              error('Programmer error: You must specify field and/or data when defining field class. ');
44          }          }
45    
46          if (!empty($field)) {          if (!empty($field)) {
47              if (is_object($field)) {              if (is_object($field)) {
48                  $this->field = $field;  // Programmer knows what they are doing, we hope                  $this->field = $field;  // Programmer knows what they are doing, we hope
49              } else if (!$this->field = get_record('data_fields','id',$field)) {              } else if (!$this->field = get_record('data_fields','id',$field)) {
50                  print_error('Bad field ID encountered: '.$field);                  error('Bad field ID encountered: '.$field);
51              }              }
52              if (empty($data)) {              if (empty($data)) {
53                  if (!$this->data = get_record('data','id',$this->field->dataid)) {                  if (!$this->data = get_record('data','id',$this->field->dataid)) {
54                      print_error('Bad data ID encountered in field data');                      error('Bad data ID encountered in field data');
55                  }                  }
56              }              }
57          }          }
# Line 61  Line 61 
61                  if (is_object($data)) {                  if (is_object($data)) {
62                      $this->data = $data;  // Programmer knows what they are doing, we hope                      $this->data = $data;  // Programmer knows what they are doing, we hope
63                  } else if (!$this->data = get_record('data','id',$data)) {                  } else if (!$this->data = get_record('data','id',$data)) {
64                      print_error('Bad data ID encountered: '.$data);                      error('Bad data ID encountered: '.$data);
65                  }                  }
66              } else {                      // No way to define it!              } else {                      // No way to define it!
67                  print_error('Data id or object must be provided to field class');                  error('Data id or object must be provided to field class');
68              }              }
69          }          }
70    
# Line 1711  Line 1711 
1711      global $USER;      global $USER;
1712    
1713      if (!$cm = get_coursemodule_from_instance('data', $data->id)) {      if (!$cm = get_coursemodule_from_instance('data', $data->id)) {
1714          print_error('Course Module ID was incorrect');          error('Course Module ID was incorrect');
1715      }      }
1716      $context = get_context_instance(CONTEXT_MODULE, $cm->id);      $context = get_context_instance(CONTEXT_MODULE, $cm->id);
1717    
# Line 1841  Line 1841 
1841    
1842      /* Check all is well */      /* Check all is well */
1843      if (!is_directory_a_preset($tempfolder)) {      if (!is_directory_a_preset($tempfolder)) {
1844          print_error("Not all files generated!");          error("Not all files generated!");
1845      }      }
1846    
1847      $filelist = array(      $filelist = array(
# Line 1884  Line 1884 
1884          global $CFG;          global $CFG;
1885    
1886          if (!is_directory_a_preset($this->folder)) {          if (!is_directory_a_preset($this->folder)) {
1887              print_error("$this->userid/$this->shortname Not a preset");              error("$this->userid/$this->shortname Not a preset");
1888          }          }
1889    
1890          /* Grab XML */          /* Grab XML */
# Line 1935  Line 1935 
1935    
1936      function import_options() {      function import_options() {
1937          if (!confirm_sesskey()) {          if (!confirm_sesskey()) {
1938              print_error("Sesskey Invalid");              error("Sesskey Invalid");
1939          }          }
1940    
1941          $strblank = get_string('blank', 'data');          $strblank = get_string('blank', 'data');
# Line 1972  Line 1972 
1972                              $selected=true;                              $selected=true;
1973                          }                          }
1974                          else {                          else {
1975                              echo '<option value="$cid">'.$currentfield->name.'</option>';                              echo '<option value="'.$cid.'">'.$currentfield->name.'</option>';
1976                          }                          }
1977                      }                      }
1978                  }                  }
# Line 1987  Line 1987 
1987              echo "<p>$strwarning</p>";              echo "<p>$strwarning</p>";
1988          }          }
1989          else if (empty($newfields)) {          else if (empty($newfields)) {
1990              print_error("New preset has no defined fields!");              error("New preset has no defined fields!");
1991          }          }
1992          echo '<input type="submit" value="'.$strcontinue.'" /></fieldset></form></div>';          echo '<input type="submit" value="'.$strcontinue.'" /></fieldset></form></div>';
1993    
# Line 2006  Line 2006 
2006                  $cid = optional_param("field_$nid", -1, PARAM_INT);                  $cid = optional_param("field_$nid", -1, PARAM_INT);
2007                  if ($cid == -1) continue;                  if ($cid == -1) continue;
2008    
2009                  if (array_key_exists($cid, $preservedfields)) print_error("Not an injective map");                  if (array_key_exists($cid, $preservedfields)) error("Not an injective map");
2010                  else $preservedfields[$cid] = true;                  else $preservedfields[$cid] = true;
2011              }              }
2012    

Legend:
Removed from v.1.151  
changed lines
  Added in v.1.152

Moodle CVS Admin
ViewVC Help
Powered by ViewVC 1.0.7