You are here

function brilliant_gallery_checklist_loadall in Brilliant Gallery 7

Same name and namespace in other branches
  1. 5.4 brilliant_gallery.module \brilliant_gallery_checklist_loadall()
  2. 5.3 brilliant_gallery.module \brilliant_gallery_checklist_loadall()
  3. 6.4 brilliant_gallery.module \brilliant_gallery_checklist_loadall()
  4. 6 brilliant_gallery.module \brilliant_gallery_checklist_loadall()
  5. 6.2 brilliant_gallery.module \brilliant_gallery_checklist_loadall()
  6. 6.3 brilliant_gallery.module \brilliant_gallery_checklist_loadall()
  7. 7.2 OLD_brilliant_gallery.module \brilliant_gallery_checklist_loadall()

Function to load the settings of all the checkboxes on this node. Note that checkboxes that have never been checked will not have an entry in the database.

1 string reference to 'brilliant_gallery_checklist_loadall'
brilliant_gallery_menu in ./brilliant_gallery_menu.inc
@todo Please document this function.

File

./brilliant_gallery.module, line 112

Code

function brilliant_gallery_checklist_loadall($nid = '') {
  global $user;
  $GLOBALS['devel_shutdown'] = FALSE;
  $uid = $user->uid;
  $dcvals = array();

  // Any checkbox id that starts with user- we remember the current user's settings
  // Any other id is global and we use user=0
  // TODO Please convert this statement to the D7 database API syntax.
  $result = db_query("select qid,state from {brilliant_gallery_checklist} where nid=:nid1 and qid not like 'user-%' and user=0 " . " union " . "select qid,state from {brilliant_gallery_checklist} where nid=:nid2 and qid like 'user-%' and user=:uid ", array(
    ':nid1' => $nid,
    ':nid2' => $nid,
    ':uid' => $uid,
  ));
  $count = 0;
  foreach ($result as $data) {
    $dcvals[$count] = array(
      'qid' => $data->qid,
      'state' => $data->state,
    );
    $count++;
  }
  print drupal_json_encode($dcvals);
  exit;
}