You are here

static function Recommender::convertAppId in Recommender API 6.2

4 calls to Recommender::convertAppId()
Recommender::purgeApp in ./Recommender.php
Recommender::__construct in ./Recommender.php
RecommenderTestCase::testBasicFunctions in ./recommender.test
recommender_get_app_id in ./recommender.module
Get the application id from the application name.

File

./Recommender.php, line 355

Class

Recommender
The super class for all other Recommender algorithms.

Code

static function convertAppId($appName) {

  //if (!isset($appName) || empty($appName)) {

  //  return NULL; // should throw an exception.

  //}
  $id = db_result(db_query("SELECT app_id FROM {recommender_app_map} WHERE app_name='%s'", $appName));
  if (!isset($id) || empty($id) || $id === FALSE) {
    db_query("INSERT INTO {recommender_app_map}(app_name) VALUE('%s')", $appName);
    $id = db_result(db_query("SELECT app_id FROM {recommender_app_map} WHERE app_name='%s'", $appName));
  }
  return $id;
}