コード例 #1
0
 /**
 	Gets a list of units sorted by system
 */
 function getAllUnits()
 {
     global $db_table_units, $alpha_sort_units, $DB_LINK, $LangUI;
     $localUnits = array();
     $unitSystem = Units::getLocalSystem();
     $localIDs = Units::getLocalUnitIDs($unitSystem);
     // Select all of the units from the database
     $sql = "SELECT unit_id,unit_desc FROM {$db_table_units} ORDER BY unit_order";
     $rc = $DB_LINK->Execute($sql);
     DBUtils::checkResult($rc, NULL, $LangUI->_('There was an error selecting the unit_id'), $sql);
     while (!$rc->EOF) {
         $id = $rc->fields['unit_id'];
         $localUnits[$id] = $rc->fields['unit_desc'];
         $rc->MoveNext();
     }
     // Returns an associative array with id->desc
     return $localUnits;
 }
コード例 #2
0
 /**
 	Constructor to create/load a Recipe
 */
 function Recipe($id = 0, $name = '', $ethnic = 'NULL', $base = 'NULL', $course = 'NULL', $time = 'NULL', $difficulty = 'NULL', $directions = '', $comments = '', $serving = 0, $source = 0, $source_desc = '', $user = NULL, $private = 'FALSE', $picture = '', $picture_type = '', $picture_oid = NULL)
 {
     global $DB_LINK, $SMObj;
     // Initial a new Recipe Object
     $this->id = $id;
     $this->name = $name;
     $this->ethnic = $ethnic;
     $this->base = $base;
     $this->course = $course;
     $this->prep_time = $time;
     $this->difficulty = $difficulty;
     $this->directions = $directions;
     $this->comments = $comments;
     $this->serving_size = $serving;
     $this->source = $source;
     $this->source_desc = $source_desc;
     $this->picture = $picture;
     $this->picture_type = $picture_type;
     $this->picture_oid = $picture_oid;
     if ($user == "" || $user == NULL) {
         $this->user = $SMObj->getUserID();
     } else {
         $this->user = $user;
     }
     if ($this->source == '') {
         $this->source = 'NULL';
     }
     $this->modified = $DB_LINK->DBDate(time());
     // set the current date
     $this->unitSystem = Units::getLocalSystem();
     if ($private == "TRUE") {
         $this->private = $DB_LINK->true;
     } else {
         $this->private = $DB_LINK->false;
     }
 }
コード例 #3
0
 /**
 	The constructor for creating a list of ingredients, the setting of values is done
 	in setIngredient and setIngredientMap
 */
 function Ingredient()
 {
     $this->system = Units::getLocalSystem();
 }