예제 #1
0
 /**
  * Copy resume to same site or another site.
  *
  * @param integer Candidate ID.
  * @param integer Site ID.
  * @return true/false.
  */
 public function copyResume($candidateID, $toCandidateID, $siteID)
 {
     $arrResume = $this->getAllResumesFields($candidateID);
     foreach ($arrResume as $resume) {
         unset($resume["attachment_id"]);
         $resume["site_id"] = $siteID;
         $file = $resume["directory_name"] . $resume["stored_filename"];
         $arrPatIhnfo = pathinfo($file);
         $resume["original_filename"] = $arrPatIhnfo["filename"] . "_copy.{$arrPatIhnfo["extension"]}";
         $resume["stored_filename"] = $arrPatIhnfo["filename"] . "_copy.{$arrPatIhnfo["extension"]}";
         if (file_exists("{$resume["directory_name"]}{$arrPatIhnfo["filename"]}.{$arrPatIhnfo["extension"]}")) {
             copy("{$resume["directory_name"]}{$arrPatIhnfo["filename"]}.{$arrPatIhnfo["extension"]}", "{$arrPatIhnfo["directory_name"]}{$arrPatIhnfo["filename"]}_copy.{$arrPatIhnfo["extension"]}");
         }
         $resume["text"] = addslashes($resume["text"]);
         $resume["data_item_id"] = $toCandidateID;
         $objSQL = new ClsNaanalSQL("INSERT");
         $objSQL->addTable("attachment");
         foreach ($resume as $field => $data) {
             $objSQL->addValue($field, $data);
         }
         $sql = $objSQL->render();
         $this->_db->query($sql);
     }
     return true;
 }
예제 #2
0
 /**
  * Sets an extra field (even if it previously existed).
  * If the requested field not exist, the data will not updated
  * 
  * @param string field name
  * @param string field value
  * @param integer candidate ID
  * @return boolean True if successful; false otherwise.
  */
 public function setValue($field, $value, $moduleID)
 {
     $objSQL = new ClsNaanalSQL();
     $objSQL->addTable("auieo_fields");
     $objSQL->addWhereNew("auieo_fields", "data_item_type", $this->_dataItemType);
     $objSQL->addWhereNew("auieo_fields", "field_name", $field);
     $objSQL->addWhereNew("auieo_fields", "site_id", $this->_siteID);
     $sql = $objSQL->render();
     $row = $this->_db->getAssoc($sql);
     if (empty($row)) {
         return false;
     }
     /* Delete old entries. */
     $sql = sprintf("DELETE FROM\n                extra_field\n            WHERE\n                extra_field.field_name = %s\n            AND\n                extra_field.data_item_id = %s\n            AND\n                extra_field.site_id = %s\n            AND\n                extra_field.data_item_type = %s", $this->_db->makeQueryString($field), $this->_db->makeQueryInteger($moduleID), $this->_siteID, $this->_dataItemType);
     $this->_db->query($sql);
     /* Don't set empty values at all. 0 is okay. */
     if (empty($value) && $value !== 0 && $value !== '0') {
         return false;
     }
     $sql = sprintf("INSERT INTO extra_field (\n                data_item_id,\n                field_name,\n                value,\n                import_id,\n                site_id,\n                data_item_type\n            )\n            VALUES (\n                %s,\n                %s,\n                %s,\n                0,\n                %s,\n                %s\n            )", $this->_db->makeQueryInteger($moduleID), $this->_db->makeQueryString($field), $this->_db->makeQueryString($value), $this->_siteID, $this->_dataItemType);
     return (bool) $this->_db->query($sql);
 }
예제 #3
0
function loadAuieoExtraField()
{
    $con=DatabaseConnection::getInstance();
    $DB= $con->getConnection();
    $DB->setQuery("select * from extra_field_settings");
    $arrExtraField=$DB->getAllAssoc();

    foreach($arrExtraField as $arrData)
    {
        $objSQL=new ClsNaanalSQL("INSERT");
        $objSQL->addTable("auieo_fields");
        
        $objSQL->addValue("data_item_type", $arrData["data_item_type"]);
        $objSQL->addValue("uitype", $arrData["extra_field_type"]);
        $field_name = cleanToVariableName($arrData["field_name"]);
        $field_name = strtolower($field_name);
        $objSQL->addValue("fieldname", $field_name);
        $objSQL->addValue("fieldlabel", $arrData["field_name"]);
        $objSQL->addValue("field_options", $arrData["extra_field_options"]);
        $objSQL->addValue("position", $arrData["position"]);
        $maximumlength=255;
        $fieldType="VARCHAR(255)";
        if($arrData["extra_field_type"]==2)
        {
            $maximumlength=0;
            $fieldType="TEXT";
        }
        else if($arrData["extra_field_type"]==3)
        {
            $maximumlength=1;
            $fieldType="INT(1)";
        }
        else if($arrData["extra_field_type"]==4)
        {
            $fieldType="DATETIME";
        }

        $objSQL->addValue("maximumlength", $maximumlength);

        $objSQL->addValue("site_id",$arrData["site_id"]);
        $arrFieldSQL=$objSQL->render();
        /**
         * ALTER IGNORE TABLE `extra_field_settings` ADD COLUMN `is_extra` int(1) default 0;
ALTER IGNORE TABLE `extra_field_settings` ADD COLUMN `presence` varchar(255) default 0;
ALTER IGNORE TABLE `extra_field_settings` ADD COLUMN `fieldlabel` varchar(255) default NULL;
ALTER IGNORE TABLE `extra_field_settings` ADD COLUMN `defaultvalue` TEXT default NULL;
ALTER IGNORE TABLE `extra_field_settings` ADD COLUMN `maximumlength` INT(11) DEFAULT '0' ;
ALTER IGNORE TABLE `extra_field_settings` ADD COLUMN `blockid` INT(11) DEFAULT '0' ;
ALTER IGNORE TABLE `extra_field_settings` ADD COLUMN `helpinfo` TEXT default NULL;
         */
        $table="";
        if($arrData["data_item_type"]==100)
        {
            $table="candidate";
        }
        else if($arrData["data_item_type"]==200)
        {
            $table="company";
        }
        else if($arrData["data_item_type"]==300)
        {
            $table="contact";
        }
        else if($arrData["data_item_type"]==400)
        {
            $table="joborder";
        }
        $arrSQL[]="ALTER IGNORE TABLE `{$table}` ADD COLUMN `{$field_name}` {$fieldType} default NULL";
        //$arrSQL[]=$arrFieldSQL;
    }
    return $arrSQL;
}