本文整理匯總了PHP中ImportMap::retrieve_by_string_fields方法的典型用法代碼示例。如果您正苦於以下問題:PHP ImportMap::retrieve_by_string_fields方法的具體用法?PHP ImportMap::retrieve_by_string_fields怎麽用?PHP ImportMap::retrieve_by_string_fields使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類ImportMap
的用法示例。
在下文中一共展示了ImportMap::retrieve_by_string_fields方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: testSaveMappingFileSavesNumberFieldAssociationCorrectly
public function testSaveMappingFileSavesNumberFieldAssociationCorrectly()
{
$lead = new Lead();
$importSource = new ImportFile($this->testFile, ',', '', false);
$importer = new Bug61172TestImporterMock($importSource, $lead);
$importer->saveMappingFile();
$mappingFile = new ImportMap();
$mappingFile->retrieve_by_string_fields(array('name' => $_REQUEST['save_map_as']));
$this->assertNotEmpty($mappingFile->content);
$contentFields = explode('&', $mappingFile->content);
$this->assertContains('1=status', $contentFields, "Field status should be associated with #1");
$mappingFile->mark_deleted($mappingFile->id);
}
示例2: ImportMap
function mark_published($user_id, $flag)
{
$other_map = new ImportMap();
if ($flag == 'yes') {
// if you are trying to publish your map
// but there's another published map
// by the same name
$query_arr = array('name' => $this->name, 'is_published' => 'yes');
} else {
// if you are trying to unpublish a map
// but you own an unpublished map by the same name
$query_arr = array('name' => $this->name, 'assigned_user_id' => $user_id, 'is_published' => 'no');
}
$other_map->retrieve_by_string_fields($query_arr, false);
if (isset($other_map->id)) {
//.. don't do it!
return -1;
}
$query = "UPDATE {$this->table_name} set is_published='{$flag}', assigned_user_id='{$user_id}' where id='" . $this->id . "'";
$this->db->query($query, true, "Error marking import map published: ");
return 1;
}
示例3: mark_published
/**
* Mark an import map as published
*
* @param string $user_id
* @param bool $flag true if we are publishing or false if we are unpublishing
* @return bool
*/
public function mark_published($user_id, $flag)
{
global $current_user;
if (!is_admin($current_user)) {
return false;
}
// check for problems
if ($flag) {
// if you are trying to publish your map
// but there's another published map
// by the same name
$query_arr = array('name' => $this->name, 'is_published' => 'yes');
} else {
// if you are trying to unpublish a map
// but you own an unpublished map by the same name
$query_arr = array('name' => $this->name, 'assigned_user_id' => $user_id, 'is_published' => 'no');
}
$other_map = new ImportMap();
$other_map->retrieve_by_string_fields($query_arr, false);
// if we find this other map, quit
if (isset($other_map->id)) {
return false;
}
// otherwise update the is_published flag
$query = "UPDATE {$this->table_name}\n SET is_published = '" . ($flag ? 'yes' : 'no') . "',\n assigned_user_id = '{$user_id}'\n WHERE id = '{$this->id}'";
$this->db->query($query, true, "Error marking import map published: ");
return true;
}