Example #1
0
 function deleteNodeProperty($property)
 {
     global $DB, $HUB_SQL, $CFG;
     try {
         $this->candelete();
     } catch (Exception $e) {
         return access_denied_error();
     }
     $dt = time();
     $params = array();
     $params[0] = $this->nodeid;
     $params[1] = $property;
     $res = $DB->delete($HUB_SQL->DATAMODEL_NODE_PROPERTY_DELETE, $params);
     if (!$res) {
         return database_error();
     } else {
         $temp = $this->load();
         auditIdea($USER->userid, $temp->nodeid, $temp->name, $temp->description, $CFG->actionEdit, format_object('xml', $temp));
         return $temp;
     }
 }
/**
 * Delete the news node from the system, if your an admin only.
 * @param $nodeid the id of the theme node to delete.
 * @return true if it all went well, else false.
 */
function adminDeleteNews($nodeid)
{
    global $CFG, $DB, $USER, $HUB_SQL;
    if (isset($USER) && $USER != "" && $USER->getIsAdmin() == "Y") {
        $n = new CNode($nodeid);
        if (!$n instanceof Error) {
            $n = $n->load();
            if ($n->role->name == "News") {
                $xml = format_object('xml', $n);
                $params = array();
                $params[0] = $nodeid;
                $sql = $HUB_SQL->DATAMODEL_NODE_DELETE;
                $res = $DB->delete($sql, $params);
                if ($res) {
                    auditIdea($USER->userid, $n->nodeid, $n->name, $n->description, $CFG->actionDelete, $xml);
                }
                return true;
            }
        }
    }
    return false;
}