english/administrator/components/com_aicontactsafe/models/fields.php
// function to duplicate one or more fields
function to duplicate one or more fields
function to duplicate one or more fields
function copyField() {
		$cid = JRequest::getVar( 'cid', array(), 'post', 'array' );
		JArrayHelper::toInteger($cid);
		if (count($cid) > 0) {
			$cids = implode(',', $cid);
		} else {
			$cids = '-1';
		}
		$db = & JFactory::getDBO();
		$query = 'SELECT * FROM `#__aicontactsafe_fields` WHERE id IN ( ' . $cids . ' )';
		$db->setQuery( $query );
		$fields_to_duplicate = $db->loadObjectList();
		if( count($fields_to_duplicate) > 0 ) {
			$datenow =& JFactory::getDate();
			foreach($fields_to_duplicate as $field_to_duplicate) {
				$field_to_duplicate->id = null;
				$field_to_duplicate->name = $this->checkDuplicatedName($field_to_duplicate->name);
				$field_to_duplicate->date_added = $datenow->toMySQL();
				$field_to_duplicate->last_update = $datenow->toMySQL();
				$db->insertObject('#__aicontactsafe_fields', $field_to_duplicate);
			}
		}
	}
function copyField ( ) { $ cid = JRequest :: getVar ( 'cid' , array ( ) , 'post' , 'array' ) ; JArrayHelper :: toInteger ( $ cid ) ; if ( count ( $ cid ) > 0 ) { $ cids = implode ( ',' , $ cid ) ; } else { $ cids = '-1' ; } $ db = & JFactory :: getDBO ( ) ; $ query = 'SELECT * FROM `#__aicontactsafe_fields` WHERE id IN ( ' . $ cids . ' )' ; $ db -> setQuery ( $ query ) ; $ fields_to_duplicate = $ db -> loadObjectList ( ) ; if ( count ( $ fields_to_duplicate ) > 0 ) { $ datenow = & JFactory :: getDate ( ) ; foreach ( $ fields_to_duplicate as $ field_to_duplicate ) { $ field_to_duplicate -> id = null ; $ field_to_duplicate -> name = $ this -> checkDuplicatedName ( $ field_to_duplicate -> name ) ; $ field_to_duplicate -> date_added = $ datenow -> toMySQL ( ) ; $ field_to_duplicate -> last_update = $ datenow -> toMySQL ( ) ; $ db -> insertObject ( '#__aicontactsafe_fields' , $ field_to_duplicate ) ; } } }
function to duplicate one or more fields
function to duplicate one or more fields
// read the ids of the records seleted to duplicate // initialize different variables // read the fields from profiles table // reset the id // modify the name // reset the date added and modified // duplicate the field