コード例 #1
0
ファイル: functions.php プロジェクト: Jonathan-Law/fhd
function saveTags($tag, $table, $id, $group, $personId, $type, $link)
{
    $database = cbSQLConnect::connect('object');
    if (isset($database)) {
        $fields = array();
        $fields['name'] = $tag;
        $fields['ftable'] = $table;
        $fields['fid'] = $id;
        $fields['category'] = $group;
        $fields['personid'] = $personId > 0 ? $personId : -1;
        $fields['type'] = $type;
        // return data
        // return $fields;
        $insert = $database->SQLInsert($fields, "tags");
        // return true if sucess or false
        if ($insert && $personId > 0) {
            $person = Person::getById($personId);
            $person = recast("Person", $person);
            $message = '
      <html>
      <head>
        <title>Recent upload to a person on your watch list.</title>
      </head>
      <body>
        <p>Something has been uploaded for ' . $person->displayName() . '</p>
        <p>Click <a href="' . $link . '">HERE</a> to view the new document, or go to their page to view new content <a href="/?controller=individual&action=homepage&id=' . $person->id . '">HERE</a></p>
        <br/>
        <p>Thank you for your continued membership!</p>
        <br/>
        <p>Sincerely</p>
        <p>-The Familyhistorydatabase crew</p>
      </body>
      </html>
      ';
            Favorites::sendUpdate($personId, $message);
            return $insert;
        } else {
            return "Insert didn't compute";
        }
    }
}